home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Sound.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  73.6 KB  |  1,862 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Sound.h
  3.  
  4.      Contains:    Sound Manager Interfaces.
  5.  
  6.      Version:    Technology:    Sound Manager 3.3
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1986-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SOUND__
  18. #define __SOUND__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __DIALOGS__
  25.     #include <Dialogs.h>
  26. #endif
  27.  
  28. #ifndef __COMPONENTS__
  29.     #include <Components.h>
  30. #endif
  31.  
  32. #ifndef __MIXEDMODE__
  33.     #include <MixedMode.h>
  34. #endif
  35.  
  36. #ifndef __MOVIES__
  37.     #include <Movies.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. /*
  64.                         * * *  N O T E  * * *
  65.  
  66.     This file has been updated to include Sound Manager 3.3 interfaces.
  67.  
  68.     Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
  69.     that originally shipped with the PowerMacs. These missing functions and the
  70.     new 3.3 interfaces have been released in the SoundLib library for PowerPC
  71.     developers to link with. The runtime library for these functions are
  72.     installed by the Sound Manager. The following functions are found in SoundLib.
  73.  
  74.         GetCompressionInfo(), GetSoundPreference(), SetSoundPreference(),
  75.         UnsignedFixedMulDiv(), SndGetInfo(), SndSetInfo(), GetSoundOutputInfo(),
  76.         SetSoundOutputInfo(), GetCompressionName(), SoundConverterOpen(),
  77.         SoundConverterClose(), SoundConverterGetBufferSizes(), SoundConverterBeginConversion(),
  78.         SoundConverterConvertBuffer(), SoundConverterEndConversion(),
  79.         AudioGetBass(), AudioGetInfo(), AudioGetMute(), AudioGetOutputDevice(),
  80.         AudioGetTreble(), AudioGetVolume(), AudioMuteOnEvent(), AudioSetBass(),
  81.         AudioSetMute(), AudioSetToDefaults(), AudioSetTreble(), AudioSetVolume(),
  82.         OpenMixerSoundComponent(), CloseMixerSoundComponent(), SoundComponentAddSource(),
  83.         SoundComponentGetInfo(), SoundComponentGetSource(), SoundComponentGetSourceData(),
  84.         SoundComponentInitOutputDevice(), SoundComponentPauseSource(),
  85.         SoundComponentPlaySourceBuffer(), SoundComponentRemoveSource(),
  86.         SoundComponentSetInfo(), SoundComponentSetOutput(), SoundComponentSetSource(),
  87.         SoundComponentStartSource(), SoundComponentStopSource(),
  88.         ParseAIFFHeader(), ParseSndHeader(), SoundConverterGetInfo(), SoundConverterSetInfo()
  89. */
  90. /*
  91.     Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  92.  
  93.     These items are no longer defined, but appear here so that someone
  94.     searching the interfaces might find them. If you are using one of these
  95.     items, you must change your code to support the Sound Manager.
  96.  
  97.         swMode, ftMode, ffMode
  98.         FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  99.         SndCompletionProcPtr
  100.         StartSound, StopSound, SoundDone
  101.         SetSoundVol, GetSoundVol
  102. */
  103. /*
  104.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105.    constants
  106.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. */
  108. #define twelfthRootTwo 1.05946309435
  109.  
  110. enum {
  111.     soundListRsrc                = FOUR_CHAR_CODE('snd ')        /*Resource type used by Sound Manager*/
  112. };
  113.  
  114. enum {
  115.     kSimpleBeepID                = 1                                /*reserved resource ID for Simple Beep*/
  116. };
  117.  
  118. enum {
  119.     rate48khz                    = (long)0xBB800000,                /*48000.00000 in fixed-point*/
  120.     rate44khz                    = (long)0xAC440000,                /*44100.00000 in fixed-point*/
  121.     rate32khz                    = 0x7D000000,                    /*32000.00000 in fixed-point*/
  122.     rate22050hz                    = 0x56220000,                    /*22050.00000 in fixed-point*/
  123.     rate22khz                    = 0x56EE8BA3,                    /*22254.54545 in fixed-point*/
  124.     rate16khz                    = 0x3E800000,                    /*16000.00000 in fixed-point*/
  125.     rate11khz                    = 0x2B7745D1,                    /*11127.27273 in fixed-point*/
  126.     rate11025hz                    = 0x2B110000,                    /*11025.00000 in fixed-point*/
  127.     rate8khz                    = 0x1F400000                    /* 8000.00000 in fixed-point*/
  128. };
  129.  
  130. /*synthesizer numbers for SndNewChannel*/
  131. enum {
  132.     sampledSynth                = 5                                /*sampled sound synthesizer*/
  133. };
  134.  
  135. #if CALL_NOT_IN_CARBON
  136. enum {
  137.     squareWaveSynth                = 1,                            /*square wave synthesizer*/
  138.     waveTableSynth                = 3,                            /*wave table synthesizer*/
  139.                                                                 /*old Sound Manager MACE synthesizer numbers*/
  140.     MACE3snthID                    = 11,
  141.     MACE6snthID                    = 13
  142. };
  143.  
  144. #endif  /* CALL_NOT_IN_CARBON */
  145.  
  146. enum {
  147.     kMiddleC                    = 60                            /*MIDI note value for middle C*/
  148. };
  149.  
  150. enum {
  151.     kNoVolume                    = 0,                            /*setting for no sound volume*/
  152.     kFullVolume                    = 0x0100                        /*1.0, setting for full hardware output volume*/
  153. };
  154.  
  155. enum {
  156.     stdQLength                    = 128
  157. };
  158.  
  159. enum {
  160.     dataOffsetFlag                = 0x8000
  161. };
  162.  
  163. enum {
  164.     kUseOptionalOutputDevice    = -1                            /*only for Sound Manager 3.0 or later*/
  165. };
  166.  
  167. enum {
  168.     notCompressed                = 0,                            /*compression ID's*/
  169.     fixedCompression            = -1,                            /*compression ID for fixed-sized compression*/
  170.     variableCompression            = -2                            /*compression ID for variable-sized compression*/
  171. };
  172.  
  173. enum {
  174.     twoToOne                    = 1,
  175.     eightToThree                = 2,
  176.     threeToOne                    = 3,
  177.     sixToOne                    = 4,
  178.     sixToOnePacketSize            = 8,
  179.     threeToOnePacketSize        = 16
  180. };
  181.  
  182. enum {
  183.     stateBlockSize                = 64,
  184.     leftOverBlockSize            = 32
  185. };
  186.  
  187. enum {
  188.     firstSoundFormat            = 0x0001,                        /*general sound format*/
  189.     secondSoundFormat            = 0x0002                        /*special sampled sound format (HyperCard)*/
  190. };
  191.  
  192. #if CALL_NOT_IN_CARBON
  193. enum {
  194.     dbBufferReady                = 0x00000001,                    /*double buffer is filled*/
  195.     dbLastBuffer                = 0x00000004                    /*last double buffer to play*/
  196. };
  197.  
  198. #endif  /* CALL_NOT_IN_CARBON */
  199.  
  200. enum {
  201.     sysBeepDisable                = 0x0000,                        /*SysBeep() enable flags*/
  202.     sysBeepEnable                = (1 << 0),
  203.     sysBeepSynchronous            = (1 << 1)                        /*if bit set, make alert sounds synchronous*/
  204. };
  205.  
  206. enum {
  207.     unitTypeNoSelection            = 0xFFFF,                        /*unitTypes for AudioSelection.unitType*/
  208.     unitTypeSeconds                = 0x0000
  209. };
  210.  
  211. enum {
  212.     stdSH                        = 0x00,                            /*Standard sound header encode value*/
  213.     extSH                        = 0xFF,                            /*Extended sound header encode value*/
  214.     cmpSH                        = 0xFE                            /*Compressed sound header encode value*/
  215. };
  216.  
  217. /*command numbers for SndDoCommand and SndDoImmediate*/
  218. enum {
  219.     nullCmd                        = 0,
  220.     quietCmd                    = 3,
  221.     flushCmd                    = 4,
  222.     reInitCmd                    = 5,
  223.     waitCmd                        = 10,
  224.     pauseCmd                    = 11,
  225.     resumeCmd                    = 12,
  226.     callBackCmd                    = 13,
  227.     syncCmd                        = 14,
  228.     availableCmd                = 24,
  229.     versionCmd                    = 25,
  230.     volumeCmd                    = 46,                            /*sound manager 3.0 or later only*/
  231.     getVolumeCmd                = 47,                            /*sound manager 3.0 or later only*/
  232.     clockComponentCmd            = 50,                            /*sound manager 3.2.1 or later only*/
  233.     getClockComponentCmd        = 51,                            /*sound manager 3.2.1 or later only*/
  234.     scheduledSoundCmd            = 52,                            /*sound manager 3.3 or later only*/
  235.     linkSoundComponentsCmd        = 53,                            /*sound manager 3.3 or later only*/
  236.     bufferCmd                    = 81,
  237.     rateMultiplierCmd            = 86,
  238.     getRateMultiplierCmd        = 87
  239. };
  240.  
  241. #if CALL_NOT_IN_CARBON
  242. /*command numbers for SndDoCommand and SndDoImmediate that are not available for use in Carbon */
  243. enum {
  244.     initCmd                        = 1,
  245.     freeCmd                        = 2,
  246.     totalLoadCmd                = 26,
  247.     loadCmd                        = 27,
  248.     freqDurationCmd                = 40,
  249.     restCmd                        = 41,
  250.     freqCmd                        = 42,
  251.     ampCmd                        = 43,
  252.     timbreCmd                    = 44,
  253.     getAmpCmd                    = 45,
  254.     waveTableCmd                = 60,
  255.     phaseCmd                    = 61,
  256.     soundCmd                    = 80,
  257.     rateCmd                        = 82,
  258.     continueCmd                    = 83,
  259.     doubleBufferCmd                = 84,
  260.     getRateCmd                    = 85,
  261.     sizeCmd                        = 90,                            /*obsolete command*/
  262.     convertCmd                    = 91                            /*obsolete MACE command*/
  263. };
  264.  
  265. #endif  /* CALL_NOT_IN_CARBON */
  266.  
  267. #if OLDROUTINENAMES
  268. /*channel initialization parameters*/
  269. enum {
  270.     waveInitChannelMask            = 0x07,
  271.     waveInitChannel0            = 0x04,                            /*wave table only, Sound Manager 2.0 and earlier*/
  272.     waveInitChannel1            = 0x05,                            /*wave table only, Sound Manager 2.0 and earlier*/
  273.     waveInitChannel2            = 0x06,                            /*wave table only, Sound Manager 2.0 and earlier*/
  274.     waveInitChannel3            = 0x07,                            /*wave table only, Sound Manager 2.0 and earlier*/
  275.     initChan0                    = waveInitChannel0,                /*obsolete spelling*/
  276.     initChan1                    = waveInitChannel1,                /*obsolete spelling*/
  277.     initChan2                    = waveInitChannel2,                /*obsolete spelling*/
  278.     initChan3                    = waveInitChannel3                /*obsolete spelling*/
  279. };
  280.  
  281. enum {
  282.     outsideCmpSH                = 0,                            /*obsolete MACE constant*/
  283.     insideCmpSH                    = 1,                            /*obsolete MACE constant*/
  284.     aceSuccess                    = 0,                            /*obsolete MACE constant*/
  285.     aceMemFull                    = 1,                            /*obsolete MACE constant*/
  286.     aceNilBlock                    = 2,                            /*obsolete MACE constant*/
  287.     aceBadComp                    = 3,                            /*obsolete MACE constant*/
  288.     aceBadEncode                = 4,                            /*obsolete MACE constant*/
  289.     aceBadDest                    = 5,                            /*obsolete MACE constant*/
  290.     aceBadCmd                    = 6                                /*obsolete MACE constant*/
  291. };
  292.  
  293. #endif  /* OLDROUTINENAMES */
  294.  
  295. enum {
  296.     initChanLeft                = 0x0002,                        /*left stereo channel*/
  297.     initChanRight                = 0x0003,                        /*right stereo channel*/
  298.     initNoInterp                = 0x0004,                        /*no linear interpolation*/
  299.     initNoDrop                    = 0x0008,                        /*no drop-sample conversion*/
  300.     initMono                    = 0x0080,                        /*monophonic channel*/
  301.     initStereo                    = 0x00C0,                        /*stereo channel*/
  302.     initMACE3                    = 0x0300,                        /*MACE 3:1*/
  303.     initMACE6                    = 0x0400,                        /*MACE 6:1*/
  304.     initPanMask                    = 0x0003,                        /*mask for right/left pan values*/
  305.     initSRateMask                = 0x0030,                        /*mask for sample rate values*/
  306.     initStereoMask                = 0x00C0,                        /*mask for mono/stereo values*/
  307.     initCompMask                = 0xFF00                        /*mask for compression IDs*/
  308. };
  309.  
  310. /*Get&Set Sound Information Selectors*/
  311. enum {
  312.     siActiveChannels            = FOUR_CHAR_CODE('chac'),        /*active channels*/
  313.     siActiveLevels                = FOUR_CHAR_CODE('lmac'),        /*active meter levels*/
  314.     siAGCOnOff                    = FOUR_CHAR_CODE('agc '),        /*automatic gain control state*/
  315.     siAsync                        = FOUR_CHAR_CODE('asyn'),        /*asynchronous capability*/
  316.     siAVDisplayBehavior            = FOUR_CHAR_CODE('avdb'),
  317.     siChannelAvailable            = FOUR_CHAR_CODE('chav'),        /*number of channels available*/
  318.     siCompressionAvailable        = FOUR_CHAR_CODE('cmav'),        /*compression types available*/
  319.     siCompressionChannels        = FOUR_CHAR_CODE('cpct'),        /*compressor's number of channels*/
  320.     siCompressionFactor            = FOUR_CHAR_CODE('cmfa'),        /*current compression factor*/
  321.     siCompressionHeader            = FOUR_CHAR_CODE('cmhd'),        /*return compression header*/
  322.     siCompressionNames            = FOUR_CHAR_CODE('cnam'),        /*compression type names available*/
  323.     siCompressionParams            = FOUR_CHAR_CODE('evaw'),        /*compression parameters*/
  324.     siCompressionSampleRate        = FOUR_CHAR_CODE('cprt'),        /*compressor's sample rate*/
  325.     siCompressionType            = FOUR_CHAR_CODE('comp'),        /*current compression type*/
  326.     siContinuous                = FOUR_CHAR_CODE('cont'),        /*continous recording*/
  327.     siDecompressionParams        = FOUR_CHAR_CODE('wave'),        /*decompression parameters*/
  328.     siDeviceBufferInfo            = FOUR_CHAR_CODE('dbin'),        /*size of interrupt buffer*/
  329.     siDeviceConnected            = FOUR_CHAR_CODE('dcon'),        /*input device connection status*/
  330.     siDeviceIcon                = FOUR_CHAR_CODE('icon'),        /*input device icon*/
  331.     siDeviceName                = FOUR_CHAR_CODE('name'),        /*input device name*/
  332.     siEQSpectrumBands            = FOUR_CHAR_CODE('eqsb'),        /* number of spectrum bands*/
  333.     siEQSpectrumLevels            = FOUR_CHAR_CODE('eqlv'),        /* gets spectum meter levels*/
  334.     siEQSpectrumOnOff            = FOUR_CHAR_CODE('eqlo'),        /* turn on/off spectum meter levels*/
  335.     siEQToneControlGain            = FOUR_CHAR_CODE('eqtg'),        /* set the bass and treble gain*/
  336.     siEQToneControlOnOff        = FOUR_CHAR_CODE('eqtc'),        /* turn on equalizer attenuation*/
  337.     siHardwareBalance            = FOUR_CHAR_CODE('hbal'),
  338.     siHardwareBalanceSteps        = FOUR_CHAR_CODE('hbls'),
  339.     siHardwareBass                = FOUR_CHAR_CODE('hbas'),
  340.     siHardwareBassSteps            = FOUR_CHAR_CODE('hbst'),
  341.     siHardwareBusy                = FOUR_CHAR_CODE('hwbs'),        /*sound hardware is in use*/
  342.     siHardwareFormat            = FOUR_CHAR_CODE('hwfm'),        /*get hardware format*/
  343.     siHardwareMute                = FOUR_CHAR_CODE('hmut'),        /*mute state of all hardware*/
  344.     siHardwareMuteNoPrefs        = FOUR_CHAR_CODE('hmnp'),        /*mute state of all hardware, but don't store in prefs */
  345.     siHardwareTreble            = FOUR_CHAR_CODE('htrb'),
  346.     siHardwareTrebleSteps        = FOUR_CHAR_CODE('hwts'),
  347.     siHardwareVolume            = FOUR_CHAR_CODE('hvol'),        /*volume level of all hardware*/
  348.     siHardwareVolumeSteps        = FOUR_CHAR_CODE('hstp'),        /*number of volume steps for hardware*/
  349.     siHeadphoneMute                = FOUR_CHAR_CODE('pmut'),        /*mute state of headphones*/
  350.     siHeadphoneVolume            = FOUR_CHAR_CODE('pvol'),        /*volume level of headphones*/
  351.     siHeadphoneVolumeSteps        = FOUR_CHAR_CODE('hdst'),        /*number of volume steps for headphones*/
  352.     siInputAvailable            = FOUR_CHAR_CODE('inav'),        /*input sources available*/
  353.     siInputGain                    = FOUR_CHAR_CODE('gain'),        /*input gain*/
  354.     siInputSource                = FOUR_CHAR_CODE('sour'),        /*input source selector*/
  355.     siInputSourceNames            = FOUR_CHAR_CODE('snam'),        /*input source names*/
  356.     siLevelMeterOnOff            = FOUR_CHAR_CODE('lmet'),        /*level meter state*/
  357.     siModemGain                    = FOUR_CHAR_CODE('mgai'),        /*modem input gain*/
  358.     siMonitorAvailable            = FOUR_CHAR_CODE('mnav'),
  359.     siMonitorSource                = FOUR_CHAR_CODE('mons'),
  360.     siNumberChannels            = FOUR_CHAR_CODE('chan'),        /*current number of channels*/
  361.     siOptionsDialog                = FOUR_CHAR_CODE('optd'),        /*display options dialog*/
  362.     siOSTypeInputSource            = FOUR_CHAR_CODE('inpt'),        /*input source by OSType*/
  363.     siOSTypeInputAvailable        = FOUR_CHAR_CODE('inav'),        /*list of available input source OSTypes*/
  364.     siOutputDeviceName            = FOUR_CHAR_CODE('onam'),        /*output device name*/
  365.     siPlayThruOnOff                = FOUR_CHAR_CODE('plth'),        /*playthrough state*/
  366.     siPostMixerSoundComponent    = FOUR_CHAR_CODE('psmx'),        /*install post-mixer effect*/
  367.     siPreMixerSoundComponent    = FOUR_CHAR_CODE('prmx'),        /*install pre-mixer effect*/
  368.     siQuality                    = FOUR_CHAR_CODE('qual'),        /*quality setting*/
  369.     siRateMultiplier            = FOUR_CHAR_CODE('rmul'),        /*throttle rate setting*/
  370.     siRecordingQuality            = FOUR_CHAR_CODE('qual'),        /*recording quality*/
  371.     siSampleRate                = FOUR_CHAR_CODE('srat'),        /*current sample rate*/
  372.     siSampleRateAvailable        = FOUR_CHAR_CODE('srav'),        /*sample rates available*/
  373.     siSampleSize                = FOUR_CHAR_CODE('ssiz'),        /*current sample size*/
  374.     siSampleSizeAvailable        = FOUR_CHAR_CODE('ssav'),        /*sample sizes available*/
  375.     siSetupCDAudio                = FOUR_CHAR_CODE('sucd'),        /*setup sound hardware for CD audio*/
  376.     siSetupModemAudio            = FOUR_CHAR_CODE('sumd'),        /*setup sound hardware for modem audio*/
  377.     siSlopeAndIntercept            = FOUR_CHAR_CODE('flap'),        /*floating point variables for conversion*/
  378.     siSoundClock                = FOUR_CHAR_CODE('sclk'),
  379.     siUseThisSoundClock            = FOUR_CHAR_CODE('sclc'),        /*sdev uses this to tell the mixer to use his sound clock*/
  380.     siSpeakerMute                = FOUR_CHAR_CODE('smut'),        /*mute state of all built-in speaker*/
  381.     siSpeakerVolume                = FOUR_CHAR_CODE('svol'),        /*volume level of built-in speaker*/
  382.     siSSpCPULoadLimit            = FOUR_CHAR_CODE('3dll'),
  383.     siSSpLocalization            = FOUR_CHAR_CODE('3dif'),
  384.     siSSpSpeakerSetup            = FOUR_CHAR_CODE('3dst'),
  385.     siStereoInputGain            = FOUR_CHAR_CODE('sgai'),        /*stereo input gain*/
  386.     siSubwooferMute                = FOUR_CHAR_CODE('bmut'),        /*mute state of sub-woofer*/
  387.     siTwosComplementOnOff        = FOUR_CHAR_CODE('twos'),        /*two's complement state*/
  388.     siVolume                    = FOUR_CHAR_CODE('volu'),        /*volume level of source*/
  389.     siVoxRecordInfo                = FOUR_CHAR_CODE('voxr'),        /*VOX record parameters*/
  390.     siVoxStopInfo                = FOUR_CHAR_CODE('voxs'),        /*VOX stop parameters*/
  391.     siWideStereo                = FOUR_CHAR_CODE('wide'),        /*wide stereo setting*/
  392.     siSupportedExtendedFlags    = FOUR_CHAR_CODE('exfl')        /*which flags are supported in Extended sound data structures*/
  393. };
  394.  
  395. enum {
  396.     siCloseDriver                = FOUR_CHAR_CODE('clos'),        /*reserved for internal use only*/
  397.     siInitializeDriver            = FOUR_CHAR_CODE('init'),        /*reserved for internal use only*/
  398.     siPauseRecording            = FOUR_CHAR_CODE('paus'),        /*reserved for internal use only*/
  399.     siUserInterruptProc            = FOUR_CHAR_CODE('user')        /*reserved for internal use only*/
  400. };
  401.  
  402. /* input source Types*/
  403. enum {
  404.     kInvalidSource                = (long)0xFFFFFFFF,                /*this source may be returned from GetInfo if no other source is the monitored source*/
  405.     kNoSource                    = FOUR_CHAR_CODE('none'),        /*no source selection*/
  406.     kCDSource                    = FOUR_CHAR_CODE('cd  '),        /*internal CD player input*/
  407.     kExtMicSource                = FOUR_CHAR_CODE('emic'),        /*external mic input*/
  408.     kSoundInSource                = FOUR_CHAR_CODE('sinj'),        /*sound input jack*/
  409.     kRCAInSource                = FOUR_CHAR_CODE('irca'),        /*RCA jack input*/
  410.     kTVFMTunerSource            = FOUR_CHAR_CODE('tvfm'),
  411.     kDAVInSource                = FOUR_CHAR_CODE('idav'),        /*DAV analog input*/
  412.     kIntMicSource                = FOUR_CHAR_CODE('imic'),        /*internal mic input*/
  413.     kMediaBaySource                = FOUR_CHAR_CODE('mbay'),        /*media bay input*/
  414.     kModemSource                = FOUR_CHAR_CODE('modm'),        /*modem input (internal modem on desktops, PCI input on PowerBooks)*/
  415.     kPCCardSource                = FOUR_CHAR_CODE('pcm '),        /*PC Card pwm input*/
  416.     kZoomVideoSource            = FOUR_CHAR_CODE('zvpc'),        /*zoom video input*/
  417.     kDVDSource                    = FOUR_CHAR_CODE('dvda')        /*DVD audio input*/
  418. };
  419.  
  420. /*Sound Component Types and Subtypes*/
  421. enum {
  422.     kNoSoundComponentType        = FOUR_CHAR_CODE('****'),
  423.     kSoundComponentType            = FOUR_CHAR_CODE('sift'),        /*component type*/
  424.     kSoundComponentPPCType        = FOUR_CHAR_CODE('nift'),        /*component type for PowerPC code*/
  425.     kRate8SubType                = FOUR_CHAR_CODE('ratb'),        /*8-bit rate converter*/
  426.     kRate16SubType                = FOUR_CHAR_CODE('ratw'),        /*16-bit rate converter*/
  427.     kConverterSubType            = FOUR_CHAR_CODE('conv'),        /*sample format converter*/
  428.     kSndSourceSubType            = FOUR_CHAR_CODE('sour'),        /*generic source component*/
  429.     kMixerType                    = FOUR_CHAR_CODE('mixr'),
  430.     kMixer8SubType                = FOUR_CHAR_CODE('mixb'),        /*8-bit mixer*/
  431.     kMixer16SubType                = FOUR_CHAR_CODE('mixw'),        /*16-bit mixer*/
  432.     kSoundInputDeviceType        = FOUR_CHAR_CODE('sinp'),        /*sound input component*/
  433.     kWaveInSubType                = FOUR_CHAR_CODE('wavi'),        /*Windows waveIn*/
  434.     kWaveInSnifferSubType        = FOUR_CHAR_CODE('wisn'),        /*Windows waveIn sniffer*/
  435.     kSoundOutputDeviceType        = FOUR_CHAR_CODE('sdev'),        /*sound output component*/
  436.     kClassicSubType                = FOUR_CHAR_CODE('clas'),        /*classic hardware, i.e. Mac Plus*/
  437.     kASCSubType                    = FOUR_CHAR_CODE('asc '),        /*Apple Sound Chip device*/
  438.     kDSPSubType                    = FOUR_CHAR_CODE('dsp '),        /*DSP device*/
  439.     kAwacsSubType                = FOUR_CHAR_CODE('awac'),        /*Another of Will's Audio Chips device*/
  440.     kGCAwacsSubType                = FOUR_CHAR_CODE('awgc'),        /*Awacs audio with Grand Central DMA*/
  441.     kSingerSubType                = FOUR_CHAR_CODE('sing'),        /*Singer (via Whitney) based sound*/
  442.     kSinger2SubType                = FOUR_CHAR_CODE('sng2'),        /*Singer 2 (via Whitney) for Acme*/
  443.     kWhitSubType                = FOUR_CHAR_CODE('whit'),        /*Whit sound component for PrimeTime 3*/
  444.     kSoundBlasterSubType        = FOUR_CHAR_CODE('sbls'),        /*Sound Blaster for CHRP*/
  445.     kWaveOutSubType                = FOUR_CHAR_CODE('wavo'),        /*Windows waveOut*/
  446.     kWaveOutSnifferSubType        = FOUR_CHAR_CODE('wosn'),        /*Windows waveOut sniffer*/
  447.     kDirectSoundSubType            = FOUR_CHAR_CODE('dsnd'),        /*Windows DirectSound*/
  448.     kDirectSoundSnifferSubType    = FOUR_CHAR_CODE('dssn'),        /*Windows DirectSound sniffer*/
  449.     kUNIXsdevSubType            = FOUR_CHAR_CODE('un1x'),        /*UNIX base sdev*/
  450.     kUSBSubType                    = FOUR_CHAR_CODE('usb '),        /*USB device*/
  451.     kBlueBoxSubType                = FOUR_CHAR_CODE('bsnd'),        /*Blue Box sound component*/
  452.     kSoundCompressor            = FOUR_CHAR_CODE('scom'),
  453.     kSoundDecompressor            = FOUR_CHAR_CODE('sdec'),
  454.     kAudioComponentType            = FOUR_CHAR_CODE('adio'),        /*Audio components and sub-types*/
  455.     kAwacsPhoneSubType            = FOUR_CHAR_CODE('hphn'),
  456.     kAudioVisionSpeakerSubType    = FOUR_CHAR_CODE('telc'),
  457.     kAudioVisionHeadphoneSubType = FOUR_CHAR_CODE('telh'),
  458.     kPhilipsFaderSubType        = FOUR_CHAR_CODE('tvav'),
  459.     kSGSToneSubType                = FOUR_CHAR_CODE('sgs0'),
  460.     kSoundEffectsType            = FOUR_CHAR_CODE('snfx'),        /*sound effects type*/
  461.     kEqualizerSubType            = FOUR_CHAR_CODE('eqal'),        /*frequency equalizer*/
  462.     kSSpLocalizationSubType        = FOUR_CHAR_CODE('snd3')
  463. };
  464.  
  465. /*Format Types*/
  466. enum {
  467.     kSoundNotCompressed            = FOUR_CHAR_CODE('NONE'),        /*sound is not compressed*/
  468.     k8BitOffsetBinaryFormat        = FOUR_CHAR_CODE('raw '),        /*8-bit offset binary*/
  469.     k16BitBigEndianFormat        = FOUR_CHAR_CODE('twos'),        /*16-bit big endian*/
  470.     k16BitLittleEndianFormat    = FOUR_CHAR_CODE('sowt'),        /*16-bit little endian*/
  471.     kFloat32Format                = FOUR_CHAR_CODE('fl32'),        /*32-bit floating point*/
  472.     kFloat64Format                = FOUR_CHAR_CODE('fl64'),        /*64-bit floating point*/
  473.     k24BitFormat                = FOUR_CHAR_CODE('in24'),        /*24-bit integer*/
  474.     k32BitFormat                = FOUR_CHAR_CODE('in32'),        /*32-bit integer*/
  475.     kMACE3Compression            = FOUR_CHAR_CODE('MAC3'),        /*MACE 3:1*/
  476.     kMACE6Compression            = FOUR_CHAR_CODE('MAC6'),        /*MACE 6:1*/
  477.     kCDXA4Compression            = FOUR_CHAR_CODE('cdx4'),        /*CD/XA 4:1*/
  478.     kCDXA2Compression            = FOUR_CHAR_CODE('cdx2'),        /*CD/XA 2:1*/
  479.     kIMACompression                = FOUR_CHAR_CODE('ima4'),        /*IMA 4:1*/
  480.     kULawCompression            = FOUR_CHAR_CODE('ulaw'),        /*.Law 2:1*/
  481.     kALawCompression            = FOUR_CHAR_CODE('alaw'),        /*aLaw 2:1*/
  482.     kMicrosoftADPCMFormat        = 0x6D730002,                    /*Microsoft ADPCM - ACM code 2*/
  483.     kDVIIntelIMAFormat            = 0x6D730011,                    /*DVI/Intel IMA ADPCM - ACM code 17*/
  484.     kDVAudioFormat                = FOUR_CHAR_CODE('dvca'),        /*DV Audio*/
  485.     kQDesignCompression            = FOUR_CHAR_CODE('QDMC'),        /*QDesign music*/
  486.     kQUALCOMMCompression        = FOUR_CHAR_CODE('Qclp'),        /*QUALCOMM PureVoice*/
  487.     kOffsetBinary                = k8BitOffsetBinaryFormat,        /*for compatibility*/
  488.     kTwosComplement                = k16BitBigEndianFormat,        /*for compatibility*/
  489.     kLittleEndianFormat            = k16BitLittleEndianFormat,        /*for compatibility*/
  490.     kMPEGLayer3Format            = 0x6D730055,                    /*MPEG Layer 3, CBR only (pre QT4.1)*/
  491.     kFullMPEGLay3Format            = FOUR_CHAR_CODE('.mp3')        /*MPEG Layer 3, CBR & VBR (QT4.1 and later)*/
  492. };
  493.  
  494. #if TARGET_RT_LITTLE_ENDIAN
  495. enum {
  496.     k16BitNativeEndianFormat    = k16BitLittleEndianFormat,
  497.     k16BitNonNativeEndianFormat    = k16BitBigEndianFormat
  498. };
  499.  
  500. #else
  501. enum {
  502.     k16BitNativeEndianFormat    = k16BitBigEndianFormat,
  503.     k16BitNonNativeEndianFormat    = k16BitLittleEndianFormat
  504. };
  505.  
  506. #endif  /* TARGET_RT_LITTLE_ENDIAN */
  507.  
  508. /*Features Flags*/
  509. enum {
  510.     k8BitRawIn                    = (1 << 0),                        /*data description*/
  511.     k8BitTwosIn                    = (1 << 1),
  512.     k16BitIn                    = (1 << 2),
  513.     kStereoIn                    = (1 << 3),
  514.     k8BitRawOut                    = (1 << 8),
  515.     k8BitTwosOut                = (1 << 9),
  516.     k16BitOut                    = (1 << 10),
  517.     kStereoOut                    = (1 << 11),
  518.     kReverse                    = (1L << 16),                    /*  function description*/
  519.     kRateConvert                = (1L << 17),
  520.     kCreateSoundSource            = (1L << 18),
  521.     kVMAwareness                = (1L << 21),                    /* component will hold its memory*/
  522.     kHighQuality                = (1L << 22),                    /*  performance description*/
  523.     kNonRealTime                = (1L << 23)
  524. };
  525.  
  526. /*SoundComponentPlaySourceBuffer action flags*/
  527. enum {
  528.     kSourcePaused                = (1 << 0),
  529.     kPassThrough                = (1L << 16),
  530.     kNoSoundComponentChain        = (1L << 17)
  531. };
  532.  
  533. /*SoundParamBlock flags, usefull for OpenMixerSoundComponent*/
  534. enum {
  535.     kNoMixing                    = (1 << 0),                        /*don't mix source*/
  536.     kNoSampleRateConversion        = (1 << 1),                        /*don't convert sample rate (i.e. 11 kHz -> 22 kHz)*/
  537.     kNoSampleSizeConversion        = (1 << 2),                        /*don't convert sample size (i.e. 16 -> 8)*/
  538.     kNoSampleFormatConversion    = (1 << 3),                        /*don't convert sample format (i.e. 'twos' -> 'raw ')*/
  539.     kNoChannelConversion        = (1 << 4),                        /*don't convert stereo/mono*/
  540.     kNoDecompression            = (1 << 5),                        /*don't decompress (i.e. 'MAC3' -> 'raw ')*/
  541.     kNoVolumeConversion            = (1 << 6),                        /*don't apply volume*/
  542.     kNoRealtimeProcessing        = (1 << 7),                        /*won't run at interrupt time*/
  543.     kScheduledSource            = (1 << 8),                        /*source is scheduled*/
  544.     kNonInterleavedBuffer        = (1 << 9),                        /*buffer is not interleaved samples*/
  545.     kNonPagingMixer                = (1 << 10),                    /*if VM is on, use the non-paging mixer*/
  546.     kSoundConverterMixer        = (1 << 11),                    /*the mixer is to be used by the SoundConverter*/
  547.     kPagingMixer                = (1 << 12),                    /*the mixer is to be used as a paging mixer when VM is on*/
  548.     kVMAwareMixer                = (1 << 13),                    /*passed to the output device when the SM is going to deal with VM safety*/
  549.     kExtendedSoundData            = (1 << 14)                        /*SoundComponentData record is actually an ExtendedSoundComponentData*/
  550. };
  551.  
  552. /*SoundParamBlock quality settings*/
  553. enum {
  554.     kBestQuality                = (1 << 0)                        /*use interpolation in rate conversion*/
  555. };
  556.  
  557. /*useful bit masks*/
  558. enum {
  559.     kInputMask                    = 0x000000FF,                    /*masks off input bits*/
  560.     kOutputMask                    = 0x0000FF00,                    /*masks off output bits*/
  561.     kOutputShift                = 8,                            /*amount output bits are shifted*/
  562.     kActionMask                    = 0x00FF0000,                    /*masks off action bits*/
  563.     kSoundComponentBits            = 0x00FFFFFF
  564. };
  565.  
  566. /*audio atom types*/
  567. enum {
  568.     kAudioFormatAtomType        = FOUR_CHAR_CODE('frma'),
  569.     kAudioEndianAtomType        = FOUR_CHAR_CODE('enda'),
  570.     kAudioVBRAtomType            = FOUR_CHAR_CODE('vbra'),
  571.     kAudioTerminatorAtomType    = 0
  572. };
  573.  
  574. /*siAVDisplayBehavior types*/
  575. enum {
  576.     kAVDisplayHeadphoneRemove    = 0,                            /* monitor does not have a headphone attached*/
  577.     kAVDisplayHeadphoneInsert    = 1,                            /* monitor has a headphone attached*/
  578.     kAVDisplayPlainTalkRemove    = 2,                            /* monitor either sending no input through CPU input port or unable to tell if input is coming in*/
  579.     kAVDisplayPlainTalkInsert    = 3                                /* monitor sending PlainTalk level microphone source input through sound input port*/
  580. };
  581.  
  582. /*Audio Component constants*/
  583. enum {
  584.                                                                 /*Values for whichChannel parameter*/
  585.     audioAllChannels            = 0,                            /*All channels (usually interpreted as both left and right)*/
  586.     audioLeftChannel            = 1,                            /*Left channel*/
  587.     audioRightChannel            = 2,                            /*Right channel*/
  588.                                                                 /*Values for mute parameter*/
  589.     audioUnmuted                = 0,                            /*Device is unmuted*/
  590.     audioMuted                    = 1,                            /*Device is muted*/
  591.                                                                 /*Capabilities flags definitions*/
  592.     audioDoesMono                = (1L << 0),                    /*Device supports mono output*/
  593.     audioDoesStereo                = (1L << 1),                    /*Device supports stereo output*/
  594.     audioDoesIndependentChannels = (1L << 2)                    /*Device supports independent software control of each channel*/
  595. };
  596.  
  597. /*Sound Input Qualities*/
  598. enum {
  599.     siCDQuality                    = FOUR_CHAR_CODE('cd  '),        /*44.1kHz, stereo, 16 bit*/
  600.     siBestQuality                = FOUR_CHAR_CODE('best'),        /*22kHz, mono, 8 bit*/
  601.     siBetterQuality                = FOUR_CHAR_CODE('betr'),        /*22kHz, mono, MACE 3:1*/
  602.     siGoodQuality                = FOUR_CHAR_CODE('good'),        /*22kHz, mono, MACE 6:1*/
  603.     siNoneQuality                = FOUR_CHAR_CODE('none')        /*settings don't match any quality for a get call*/
  604. };
  605.  
  606. enum {
  607.     siDeviceIsConnected            = 1,                            /*input device is connected and ready for input*/
  608.     siDeviceNotConnected        = 0,                            /*input device is not connected*/
  609.     siDontKnowIfConnected        = -1,                            /*can't tell if input device is connected*/
  610.     siReadPermission            = 0,                            /*permission passed to SPBOpenDevice*/
  611.     siWritePermission            = 1                                /*permission passed to SPBOpenDevice*/
  612. };
  613.  
  614. /*flags that SoundConverterFillBuffer will return*/
  615. enum {
  616.     kSoundConverterDidntFillBuffer = (1 << 0),                    /*set if the converter couldn't completely satisfy a SoundConverterFillBuffer request*/
  617.     kSoundConverterHasLeftOverData = (1 << 1)                    /*set if the converter had left over data after completely satisfying a SoundConverterFillBuffer call*/
  618. };
  619.  
  620. /* flags for extendedFlags fields of ExtendedSoundComponentData, ExtendedSoundParamBlock, and ExtendedScheduledSoundHeader*/
  621. enum {
  622.     kExtendedSoundSampleCountNotValid = 1L << 0,                /* set if sampleCount of SoundComponentData isn't meaningful; use buffer size instead*/
  623.     kExtendedSoundBufferSizeValid = 1L << 1                        /* set if bufferSize field is valid*/
  624. };
  625.  
  626. /*
  627.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  628.    typedefs
  629.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  630. */
  631.  
  632.  
  633. struct SndCommand {
  634.     unsigned short                     cmd;
  635.     short                             param1;
  636.     long                             param2;
  637. };
  638. typedef struct SndCommand                SndCommand;
  639. typedef struct SndChannel                 SndChannel;
  640.  
  641. typedef SndChannel *                    SndChannelPtr;
  642. typedef CALLBACK_API( void , SndCallBackProcPtr )(SndChannelPtr chan, SndCommand *cmd);
  643. typedef STACK_UPP_TYPE(SndCallBackProcPtr)                         SndCallBackUPP;
  644.  
  645. struct SndChannel {
  646.     SndChannelPtr                     nextChan;
  647.     Ptr                             firstMod;                    /* reserved for the Sound Manager */
  648.     SndCallBackUPP                     callBack;
  649.     long                             userInfo;
  650.     long                             wait;                        /* The following is for internal Sound Manager use only.*/
  651.     SndCommand                         cmdInProgress;
  652.     short                             flags;
  653.     short                             qLength;
  654.     short                             qHead;
  655.     short                             qTail;
  656.     SndCommand                         queue[128];
  657. };
  658.  
  659. #if OPAQUE_UPP_TYPES
  660.     EXTERN_API(SndCallBackUPP)
  661.     NewSndCallBackUPP               (SndCallBackProcPtr        userRoutine);
  662.  
  663.     EXTERN_API(void)
  664.     DisposeSndCallBackUPP           (SndCallBackUPP            userUPP);
  665.  
  666.     EXTERN_API(void)
  667.     InvokeSndCallBackUPP           (SndChannelPtr            chan,
  668.                                     SndCommand *            cmd,
  669.                                     SndCallBackUPP            userUPP);
  670.  
  671. #else
  672.     enum { uppSndCallBackProcInfo = 0x000003C0 };                     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  673.     #define NewSndCallBackUPP(userRoutine)                             (SndCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  674.     #define DisposeSndCallBackUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  675.     #define InvokeSndCallBackUPP(chan, cmd, userUPP)                 CALL_TWO_PARAMETER_UPP((userUPP), uppSndCallBackProcInfo, (chan), (cmd))
  676. #endif
  677. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  678. #define NewSndCallBackProc(userRoutine)                         NewSndCallBackUPP(userRoutine)
  679. #define CallSndCallBackProc(userRoutine, chan, cmd)                InvokeSndCallBackUPP(chan, cmd, userRoutine)
  680. /*MACE structures*/
  681.  
  682. struct StateBlock {
  683.     short                             stateVar[64];
  684. };
  685. typedef struct StateBlock                StateBlock;
  686. typedef StateBlock *                    StateBlockPtr;
  687.  
  688. struct LeftOverBlock {
  689.     unsigned long                     count;
  690.     SInt8                             sampleArea[32];
  691. };
  692. typedef struct LeftOverBlock            LeftOverBlock;
  693. typedef LeftOverBlock *                    LeftOverBlockPtr;
  694.  
  695. struct ModRef {
  696.     unsigned short                     modNumber;
  697.     long                             modInit;
  698. };
  699. typedef struct ModRef                    ModRef;
  700.  
  701. struct SndListResource {
  702.     short                             format;
  703.     short                             numModifiers;
  704.     ModRef                             modifierPart[1];
  705.     short                             numCommands;
  706.     SndCommand                         commandPart[1];
  707.     UInt8                             dataPart[1];
  708. };
  709. typedef struct SndListResource            SndListResource;
  710.  
  711. typedef SndListResource *                SndListPtr;
  712. typedef SndListPtr *                    SndListHandle;
  713. typedef SndListHandle                     SndListHndl;
  714. /*HyperCard sound resource format*/
  715.  
  716. struct Snd2ListResource {
  717.     short                             format;
  718.     short                             refCount;
  719.     short                             numCommands;
  720.     SndCommand                         commandPart[1];
  721.     UInt8                             dataPart[1];
  722. };
  723. typedef struct Snd2ListResource            Snd2ListResource;
  724.  
  725. typedef Snd2ListResource *                Snd2ListPtr;
  726. typedef Snd2ListPtr *                    Snd2ListHandle;
  727. typedef Snd2ListHandle                     Snd2ListHndl;
  728.  
  729. struct SoundHeader {
  730.     Ptr                             samplePtr;                    /*if NIL then samples are in sampleArea*/
  731.     unsigned long                     length;                        /*length of sound in bytes*/
  732.     UnsignedFixed                     sampleRate;                    /*sample rate for this sound*/
  733.     unsigned long                     loopStart;                    /*start of looping portion*/
  734.     unsigned long                     loopEnd;                    /*end of looping portion*/
  735.     UInt8                             encode;                        /*header encoding*/
  736.     UInt8                             baseFrequency;                /*baseFrequency value*/
  737.     UInt8                             sampleArea[1];                /*space for when samples follow directly*/
  738. };
  739. typedef struct SoundHeader                SoundHeader;
  740. typedef SoundHeader *                    SoundHeaderPtr;
  741.  
  742. struct CmpSoundHeader {
  743.     Ptr                             samplePtr;                    /*if nil then samples are in sample area*/
  744.     unsigned long                     numChannels;                /*number of channels i.e. mono = 1*/
  745.     UnsignedFixed                     sampleRate;                    /*sample rate in Apples Fixed point representation*/
  746.     unsigned long                     loopStart;                    /*loopStart of sound before compression*/
  747.     unsigned long                     loopEnd;                    /*loopEnd of sound before compression*/
  748.     UInt8                             encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  749.     UInt8                             baseFrequency;                /*same meaning as regular SoundHeader*/
  750.     unsigned long                     numFrames;                    /*length in frames ( packetFrames or sampleFrames )*/
  751.     extended80                         AIFFSampleRate;                /*IEEE sample rate*/
  752.     Ptr                             markerChunk;                /*sync track*/
  753.     OSType                             format;                        /*data format type, was futureUse1*/
  754.     unsigned long                     futureUse2;                    /*reserved by Apple*/
  755.     StateBlockPtr                     stateVars;                    /*pointer to State Block*/
  756.     LeftOverBlockPtr                 leftOverSamples;            /*used to save truncated samples between compression calls*/
  757.     short                             compressionID;                /*0 means no compression, non zero means compressionID*/
  758.     unsigned short                     packetSize;                    /*number of bits in compressed sample packet*/
  759.     unsigned short                     snthID;                        /*resource ID of Sound Manager snth that contains NRT C/E*/
  760.     unsigned short                     sampleSize;                    /*number of bits in non-compressed sample*/
  761.     UInt8                             sampleArea[1];                /*space for when samples follow directly*/
  762. };
  763. typedef struct CmpSoundHeader            CmpSoundHeader;
  764. typedef CmpSoundHeader *                CmpSoundHeaderPtr;
  765.  
  766. struct ExtSoundHeader {
  767.     Ptr                             samplePtr;                    /*if nil then samples are in sample area*/
  768.     unsigned long                     numChannels;                /*number of channels,  ie mono = 1*/
  769.     UnsignedFixed                     sampleRate;                    /*sample rate in Apples Fixed point representation*/
  770.     unsigned long                     loopStart;                    /*same meaning as regular SoundHeader*/
  771.     unsigned long                     loopEnd;                    /*same meaning as regular SoundHeader*/
  772.     UInt8                             encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  773.     UInt8                             baseFrequency;                /*same meaning as regular SoundHeader*/
  774.     unsigned long                     numFrames;                    /*length in total number of frames*/
  775.     extended80                         AIFFSampleRate;                /*IEEE sample rate*/
  776.     Ptr                             markerChunk;                /*sync track*/
  777.     Ptr                             instrumentChunks;            /*AIFF instrument chunks*/
  778.     Ptr                             AESRecording;
  779.     unsigned short                     sampleSize;                    /*number of bits in sample*/
  780.     unsigned short                     futureUse1;                    /*reserved by Apple*/
  781.     unsigned long                     futureUse2;                    /*reserved by Apple*/
  782.     unsigned long                     futureUse3;                    /*reserved by Apple*/
  783.     unsigned long                     futureUse4;                    /*reserved by Apple*/
  784.     UInt8                             sampleArea[1];                /*space for when samples follow directly*/
  785. };
  786. typedef struct ExtSoundHeader            ExtSoundHeader;
  787. typedef ExtSoundHeader *                ExtSoundHeaderPtr;
  788.  
  789. union SoundHeaderUnion {
  790.     SoundHeader                     stdHeader;
  791.     CmpSoundHeader                     cmpHeader;
  792.     ExtSoundHeader                     extHeader;
  793. };
  794. typedef union SoundHeaderUnion            SoundHeaderUnion;
  795.  
  796. struct ConversionBlock {
  797.     short                             destination;
  798.     short                             unused;
  799.     CmpSoundHeaderPtr                 inputPtr;
  800.     CmpSoundHeaderPtr                 outputPtr;
  801. };
  802. typedef struct ConversionBlock            ConversionBlock;
  803. typedef ConversionBlock *                ConversionBlockPtr;
  804. /* ScheduledSoundHeader flags*/
  805. enum {
  806.     kScheduledSoundDoScheduled    = 1 << 0,
  807.     kScheduledSoundDoCallBack    = 1 << 1,
  808.     kScheduledSoundExtendedHdr    = 1 << 2
  809. };
  810.  
  811.  
  812. struct ScheduledSoundHeader {
  813.     SoundHeaderUnion                 u;
  814.     long                             flags;
  815.     short                             reserved;
  816.     short                             callBackParam1;
  817.     long                             callBackParam2;
  818.     TimeRecord                         startTime;
  819. };
  820. typedef struct ScheduledSoundHeader        ScheduledSoundHeader;
  821. typedef ScheduledSoundHeader *            ScheduledSoundHeaderPtr;
  822.  
  823. struct ExtendedScheduledSoundHeader {
  824.     SoundHeaderUnion                 u;
  825.     long                             flags;
  826.     short                             reserved;
  827.     short                             callBackParam1;
  828.     long                             callBackParam2;
  829.     TimeRecord                         startTime;
  830.     long                             recordSize;
  831.     long                             extendedFlags;
  832.     long                             bufferSize;
  833. };
  834. typedef struct ExtendedScheduledSoundHeader ExtendedScheduledSoundHeader;
  835. typedef ExtendedScheduledSoundHeader *    ExtendedScheduledSoundHeaderPtr;
  836.  
  837. struct SMStatus {
  838.     short                             smMaxCPULoad;
  839.     short                             smNumChannels;
  840.     short                             smCurCPULoad;
  841. };
  842. typedef struct SMStatus                    SMStatus;
  843. typedef SMStatus *                        SMStatusPtr;
  844.  
  845. struct SCStatus {
  846.     UnsignedFixed                     scStartTime;
  847.     UnsignedFixed                     scEndTime;
  848.     UnsignedFixed                     scCurrentTime;
  849.     Boolean                         scChannelBusy;
  850.     Boolean                         scChannelDisposed;
  851.     Boolean                         scChannelPaused;
  852.     Boolean                         scUnused;
  853.     unsigned long                     scChannelAttributes;
  854.     long                             scCPULoad;
  855. };
  856. typedef struct SCStatus                    SCStatus;
  857. typedef SCStatus *                        SCStatusPtr;
  858.  
  859. struct AudioSelection {
  860.     long                             unitType;
  861.     UnsignedFixed                     selStart;
  862.     UnsignedFixed                     selEnd;
  863. };
  864. typedef struct AudioSelection            AudioSelection;
  865. typedef AudioSelection *                AudioSelectionPtr;
  866. #if CALL_NOT_IN_CARBON
  867.  
  868. struct SndDoubleBuffer {
  869.     long                             dbNumFrames;
  870.     long                             dbFlags;
  871.     long                             dbUserInfo[2];
  872.     SInt8                             dbSoundData[1];
  873. };
  874. typedef struct SndDoubleBuffer            SndDoubleBuffer;
  875. typedef SndDoubleBuffer *                SndDoubleBufferPtr;
  876.  
  877.  
  878. typedef CALLBACK_API( void , SndDoubleBackProcPtr )(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  879. typedef STACK_UPP_TYPE(SndDoubleBackProcPtr)                     SndDoubleBackUPP;
  880. #if OPAQUE_UPP_TYPES
  881.     EXTERN_API(SndDoubleBackUPP)
  882.     NewSndDoubleBackUPP               (SndDoubleBackProcPtr    userRoutine);
  883.  
  884.     EXTERN_API(void)
  885.     DisposeSndDoubleBackUPP           (SndDoubleBackUPP        userUPP);
  886.  
  887.     EXTERN_API(void)
  888.     InvokeSndDoubleBackUPP           (SndChannelPtr            channel,
  889.                                     SndDoubleBufferPtr        doubleBufferPtr,
  890.                                     SndDoubleBackUPP        userUPP);
  891.  
  892. #else
  893.     enum { uppSndDoubleBackProcInfo = 0x000003C0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes) */
  894.     #define NewSndDoubleBackUPP(userRoutine)                         (SndDoubleBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  895.     #define DisposeSndDoubleBackUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  896.     #define InvokeSndDoubleBackUPP(channel, doubleBufferPtr, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  897. #endif
  898. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  899. #define NewSndDoubleBackProc(userRoutine)                         NewSndDoubleBackUPP(userRoutine)
  900. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr) InvokeSndDoubleBackUPP(channel, doubleBufferPtr, userRoutine)
  901.  
  902. struct SndDoubleBufferHeader {
  903.     short                             dbhNumChannels;
  904.     short                             dbhSampleSize;
  905.     short                             dbhCompressionID;
  906.     short                             dbhPacketSize;
  907.     UnsignedFixed                     dbhSampleRate;
  908.     SndDoubleBufferPtr                 dbhBufferPtr[2];
  909.     SndDoubleBackUPP                 dbhDoubleBack;
  910. };
  911. typedef struct SndDoubleBufferHeader    SndDoubleBufferHeader;
  912. typedef SndDoubleBufferHeader *            SndDoubleBufferHeaderPtr;
  913.  
  914. struct SndDoubleBufferHeader2 {
  915.     short                             dbhNumChannels;
  916.     short                             dbhSampleSize;
  917.     short                             dbhCompressionID;
  918.     short                             dbhPacketSize;
  919.     UnsignedFixed                     dbhSampleRate;
  920.     SndDoubleBufferPtr                 dbhBufferPtr[2];
  921.     SndDoubleBackUPP                 dbhDoubleBack;
  922.     OSType                             dbhFormat;
  923. };
  924. typedef struct SndDoubleBufferHeader2    SndDoubleBufferHeader2;
  925. typedef SndDoubleBufferHeader2 *        SndDoubleBufferHeader2Ptr;
  926. #endif  /* CALL_NOT_IN_CARBON */
  927.  
  928.  
  929. struct SoundInfoList {
  930.     short                             count;
  931.     Handle                             infoHandle;
  932. };
  933. typedef struct SoundInfoList            SoundInfoList;
  934. typedef SoundInfoList *                    SoundInfoListPtr;
  935.  
  936. struct SoundComponentData {
  937.     long                             flags;
  938.     OSType                             format;
  939.     short                             numChannels;
  940.     short                             sampleSize;
  941.     UnsignedFixed                     sampleRate;
  942.     long                             sampleCount;
  943.     Byte *                            buffer;
  944.     long                             reserved;
  945. };
  946. typedef struct SoundComponentData        SoundComponentData;
  947. typedef SoundComponentData *            SoundComponentDataPtr;
  948.  
  949. struct ExtendedSoundComponentData {
  950.     SoundComponentData                 desc;                        /*description of sound buffer*/
  951.     long                             recordSize;                    /*size of this record in bytes*/
  952.     long                             extendedFlags;                /*flags for extended record*/
  953.     long                             bufferSize;                    /*size of buffer in bytes*/
  954. };
  955. typedef struct ExtendedSoundComponentData ExtendedSoundComponentData;
  956. typedef ExtendedSoundComponentData *    ExtendedSoundComponentDataPtr;
  957. typedef struct SoundParamBlock             SoundParamBlock;
  958.  
  959. typedef SoundParamBlock *                SoundParamBlockPtr;
  960. typedef CALLBACK_API( Boolean , SoundParamProcPtr )(SoundParamBlockPtr *pb);
  961. typedef STACK_UPP_TYPE(SoundParamProcPtr)                         SoundParamUPP;
  962.  
  963. struct SoundParamBlock {
  964.     long                             recordSize;                    /*size of this record in bytes*/
  965.     SoundComponentData                 desc;                        /*description of sound buffer*/
  966.     UnsignedFixed                     rateMultiplier;                /*rate multiplier to apply to sound*/
  967.     short                             leftVolume;                    /*volumes to apply to sound*/
  968.     short                             rightVolume;
  969.     long                             quality;                    /*quality to apply to sound*/
  970.     ComponentInstance                 filter;                        /*filter to apply to sound*/
  971.     SoundParamUPP                     moreRtn;                    /*routine to call to get more data*/
  972.     SoundParamUPP                     completionRtn;                /*routine to call when buffer is complete*/
  973.     long                             refCon;                        /*user refcon*/
  974.     short                             result;                        /*result*/
  975. };
  976.  
  977.  
  978. struct ExtendedSoundParamBlock {
  979.     SoundParamBlock                 pb;                            /*classic SoundParamBlock except recordSize == sizeof(ExtendedSoundParamBlock)*/
  980.     short                             reserved;
  981.     long                             extendedFlags;                /*flags*/
  982.     long                             bufferSize;                    /*size of buffer in bytes*/
  983. };
  984. typedef struct ExtendedSoundParamBlock    ExtendedSoundParamBlock;
  985. typedef ExtendedSoundParamBlock *        ExtendedSoundParamBlockPtr;
  986.  
  987. struct CompressionInfo {
  988.     long                             recordSize;
  989.     OSType                             format;
  990.     short                             compressionID;
  991.     unsigned short                     samplesPerPacket;
  992.     unsigned short                     bytesPerPacket;
  993.     unsigned short                     bytesPerFrame;
  994.     unsigned short                     bytesPerSample;
  995.     unsigned short                     futureUse1;
  996. };
  997. typedef struct CompressionInfo            CompressionInfo;
  998. typedef CompressionInfo *                CompressionInfoPtr;
  999. typedef CompressionInfoPtr *            CompressionInfoHandle;
  1000. /*variables for floating point conversion*/
  1001.  
  1002. struct SoundSlopeAndInterceptRecord {
  1003.     Float64                         slope;
  1004.     Float64                         intercept;
  1005.     Float64                         minClip;
  1006.     Float64                         maxClip;
  1007. };
  1008. typedef struct SoundSlopeAndInterceptRecord SoundSlopeAndInterceptRecord;
  1009.  
  1010. typedef SoundSlopeAndInterceptRecord *    SoundSlopeAndInterceptPtr;
  1011. /*private thing to use as a reference to a Sound Converter*/
  1012. typedef struct OpaqueSoundConverter*     SoundConverter;
  1013. /*callback routine to provide data to the Sound Converter*/
  1014. typedef CALLBACK_API( Boolean , SoundConverterFillBufferDataProcPtr )(SoundComponentDataPtr *data, void *refCon);
  1015. typedef STACK_UPP_TYPE(SoundConverterFillBufferDataProcPtr)     SoundConverterFillBufferDataUPP;
  1016. /*private thing to use as a reference to a Sound Source*/
  1017. typedef struct OpaqueSoundSource*         SoundSource;
  1018. typedef SoundSource *                    SoundSourcePtr;
  1019.  
  1020.  
  1021.  
  1022. struct SoundComponentLink {
  1023.     ComponentDescription             description;                /*Describes the sound component*/
  1024.     SoundSource                     mixerID;                    /*Reserved by Apple*/
  1025.     SoundSource *                    linkID;                        /*Reserved by Apple*/
  1026. };
  1027. typedef struct SoundComponentLink        SoundComponentLink;
  1028. typedef SoundComponentLink *            SoundComponentLinkPtr;
  1029.  
  1030. struct AudioInfo {
  1031.     long                             capabilitiesFlags;            /*Describes device capabilities*/
  1032.     long                             reserved;                    /*Reserved by Apple*/
  1033.     unsigned short                     numVolumeSteps;                /*Number of significant increments between min and max volume*/
  1034. };
  1035. typedef struct AudioInfo                AudioInfo;
  1036. typedef AudioInfo *                        AudioInfoPtr;
  1037.  
  1038. struct AudioFormatAtom {
  1039.     long                             size;                        /* = sizeof(AudioFormatAtom)*/
  1040.     OSType                             atomType;                    /* = kAudioFormatAtomType*/
  1041.     OSType                             format;
  1042. };
  1043. typedef struct AudioFormatAtom            AudioFormatAtom;
  1044. typedef AudioFormatAtom *                AudioFormatAtomPtr;
  1045.  
  1046. struct AudioEndianAtom {
  1047.     long                             size;                        /* = sizeof(AudioEndianAtom)*/
  1048.     OSType                             atomType;                    /* = kAudioEndianAtomType*/
  1049.     short                             littleEndian;
  1050. };
  1051. typedef struct AudioEndianAtom            AudioEndianAtom;
  1052. typedef AudioEndianAtom *                AudioEndianAtomPtr;
  1053.  
  1054. struct AudioTerminatorAtom {
  1055.     long                             size;                        /* = sizeof(AudioTerminatorAtom)*/
  1056.     OSType                             atomType;                    /* = kAudioTerminatorAtomType*/
  1057. };
  1058. typedef struct AudioTerminatorAtom        AudioTerminatorAtom;
  1059. typedef AudioTerminatorAtom *            AudioTerminatorAtomPtr;
  1060.  
  1061. struct LevelMeterInfo {
  1062.     short                             numChannels;                /* mono or stereo source*/
  1063.     UInt8                             leftMeter;                    /* 0-255 range*/
  1064.     UInt8                             rightMeter;                    /* 0-255 range*/
  1065. };
  1066. typedef struct LevelMeterInfo            LevelMeterInfo;
  1067. typedef LevelMeterInfo *                LevelMeterInfoPtr;
  1068.  
  1069. struct EQSpectrumBandsRecord {
  1070.     short                             count;
  1071.     UnsignedFixedPtr                 frequency;                    /* pointer to array of frequencies*/
  1072. };
  1073. typedef struct EQSpectrumBandsRecord    EQSpectrumBandsRecord;
  1074. typedef EQSpectrumBandsRecord *            EQSpectrumBandsRecordPtr;
  1075.  
  1076.  
  1077. /* Sound Input Structures*/
  1078. typedef struct SPB                         SPB;
  1079.  
  1080. typedef SPB *                            SPBPtr;
  1081.  
  1082.  
  1083. /*user procedures called by sound input routines*/
  1084. typedef CALLBACK_API( void , SIInterruptProcPtr )(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize);
  1085. /*
  1086.     WARNING: SIInterruptProcPtr uses register based parameters under classic 68k
  1087.              and cannot be written in a high-level language without 
  1088.              the help of mixed mode or assembly glue.
  1089. */
  1090. typedef CALLBACK_API( void , SICompletionProcPtr )(SPBPtr inParamPtr);
  1091. typedef REGISTER_UPP_TYPE(SIInterruptProcPtr)                     SIInterruptUPP;
  1092. typedef STACK_UPP_TYPE(SICompletionProcPtr)                     SICompletionUPP;
  1093.  
  1094.  
  1095. /*Sound Input Parameter Block*/
  1096.  
  1097. struct SPB {
  1098.     long                             inRefNum;                    /*reference number of sound input device*/
  1099.     unsigned long                     count;                        /*number of bytes to record*/
  1100.     unsigned long                     milliseconds;                /*number of milliseconds to record*/
  1101.     unsigned long                     bufferLength;                /*length of buffer in bytes*/
  1102.     Ptr                             bufferPtr;                    /*buffer to store sound data in*/
  1103.     SICompletionUPP                 completionRoutine;            /*completion routine*/
  1104.     SIInterruptUPP                     interruptRoutine;            /*interrupt routine*/
  1105.     long                             userLong;                    /*user-defined field*/
  1106.     OSErr                             error;                        /*error*/
  1107.     long                             unused1;                    /*reserved - must be zero*/
  1108. };
  1109.  
  1110. #if OPAQUE_UPP_TYPES
  1111.     EXTERN_API(SoundParamUPP)
  1112.     NewSoundParamUPP               (SoundParamProcPtr        userRoutine);
  1113.  
  1114.     EXTERN_API(SoundConverterFillBufferDataUPP)
  1115.     NewSoundConverterFillBufferDataUPP    (SoundConverterFillBufferDataProcPtr userRoutine);
  1116.  
  1117.     EXTERN_API(SIInterruptUPP)
  1118.     NewSIInterruptUPP               (SIInterruptProcPtr        userRoutine);
  1119.  
  1120.     EXTERN_API(SICompletionUPP)
  1121.     NewSICompletionUPP               (SICompletionProcPtr        userRoutine);
  1122.  
  1123.     EXTERN_API(void)
  1124.     DisposeSoundParamUPP           (SoundParamUPP            userUPP);
  1125.  
  1126.     EXTERN_API(void)
  1127.     DisposeSoundConverterFillBufferDataUPP    (SoundConverterFillBufferDataUPP userUPP);
  1128.  
  1129.     EXTERN_API(void)
  1130.     DisposeSIInterruptUPP           (SIInterruptUPP            userUPP);
  1131.  
  1132.     EXTERN_API(void)
  1133.     DisposeSICompletionUPP           (SICompletionUPP            userUPP);
  1134.  
  1135.     EXTERN_API(Boolean)
  1136.     InvokeSoundParamUPP               (SoundParamBlockPtr *    pb,
  1137.                                     SoundParamUPP            userUPP);
  1138.  
  1139.     EXTERN_API(Boolean)
  1140.     InvokeSoundConverterFillBufferDataUPP    (SoundComponentDataPtr * data,
  1141.                                     void *                    refCon,
  1142.                                     SoundConverterFillBufferDataUPP userUPP);
  1143.  
  1144.     EXTERN_API(void)
  1145.     InvokeSIInterruptUPP           (SPBPtr                    inParamPtr,
  1146.                                     Ptr                        dataBuffer,
  1147.                                     short                    peakAmplitude,
  1148.                                     long                    sampleSize,
  1149.                                     SIInterruptUPP            userUPP);
  1150.  
  1151.     EXTERN_API(void)
  1152.     InvokeSICompletionUPP           (SPBPtr                    inParamPtr,
  1153.                                     SICompletionUPP            userUPP);
  1154.  
  1155. #else
  1156.     enum { uppSoundParamProcInfo = 0x000000D0 };                     /* pascal 1_byte Func(4_bytes) */
  1157.     enum { uppSoundConverterFillBufferDataProcInfo = 0x000003D0 };     /* pascal 1_byte Func(4_bytes, 4_bytes) */
  1158.     enum { uppSIInterruptProcInfo = 0x1C579802 };                     /* register no_return_value Func(4_bytes:A0, 4_bytes:A1, 2_bytes:D0, 4_bytes:D1) */
  1159.     enum { uppSICompletionProcInfo = 0x000000C0 };                     /* pascal no_return_value Func(4_bytes) */
  1160.     #define NewSoundParamUPP(userRoutine)                             (SoundParamUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundParamProcInfo, GetCurrentArchitecture())
  1161.     #define NewSoundConverterFillBufferDataUPP(userRoutine)         (SoundConverterFillBufferDataUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundConverterFillBufferDataProcInfo, GetCurrentArchitecture())
  1162.     #define NewSIInterruptUPP(userRoutine)                             (SIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIInterruptProcInfo, GetCurrentArchitecture())
  1163.     #define NewSICompletionUPP(userRoutine)                         (SICompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSICompletionProcInfo, GetCurrentArchitecture())
  1164.     #define DisposeSoundParamUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  1165.     #define DisposeSoundConverterFillBufferDataUPP(userUPP)         DisposeRoutineDescriptor(userUPP)
  1166.     #define DisposeSIInterruptUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  1167.     #define DisposeSICompletionUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1168.     #define InvokeSoundParamUPP(pb, userUPP)                         (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppSoundParamProcInfo, (pb))
  1169.     #define InvokeSoundConverterFillBufferDataUPP(data, refCon, userUPP)  (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppSoundConverterFillBufferDataProcInfo, (data), (refCon))
  1170.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1171.     /* InvokeSIInterruptUPP can't be called from classic 68k without glue code */
  1172.     #else
  1173.         #define InvokeSIInterruptUPP(inParamPtr, dataBuffer, peakAmplitude, sampleSize, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppSIInterruptProcInfo, (inParamPtr), (dataBuffer), (peakAmplitude), (sampleSize))
  1174.     #endif
  1175.     #define InvokeSICompletionUPP(inParamPtr, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppSICompletionProcInfo, (inParamPtr))
  1176. #endif
  1177. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1178. #define NewSoundParamProc(userRoutine)                             NewSoundParamUPP(userRoutine)
  1179. #define NewSoundConverterFillBufferDataProc(userRoutine)         NewSoundConverterFillBufferDataUPP(userRoutine)
  1180. #define NewSIInterruptProc(userRoutine)                         NewSIInterruptUPP(userRoutine)
  1181. #define NewSICompletionProc(userRoutine)                         NewSICompletionUPP(userRoutine)
  1182. #define CallSoundParamProc(userRoutine, pb)                        InvokeSoundParamUPP(pb, userRoutine)
  1183. #define CallSoundConverterFillBufferDataProc(userRoutine, data, refCon) InvokeSoundConverterFillBufferDataUPP(data, refCon, userRoutine)
  1184. #define CallSIInterruptProc(userRoutine, inParamPtr, dataBuffer, peakAmplitude, sampleSize) InvokeSIInterruptUPP(inParamPtr, dataBuffer, peakAmplitude, sampleSize, userRoutine)
  1185. #define CallSICompletionProc(userRoutine, inParamPtr)            InvokeSICompletionUPP(inParamPtr, userRoutine)
  1186. typedef CALLBACK_API( void , FilePlayCompletionProcPtr )(SndChannelPtr chan);
  1187. typedef STACK_UPP_TYPE(FilePlayCompletionProcPtr)                 FilePlayCompletionUPP;
  1188. #if OPAQUE_UPP_TYPES
  1189.     EXTERN_API(FilePlayCompletionUPP)
  1190.     NewFilePlayCompletionUPP       (FilePlayCompletionProcPtr userRoutine);
  1191.  
  1192.     EXTERN_API(void)
  1193.     DisposeFilePlayCompletionUPP    (FilePlayCompletionUPP    userUPP);
  1194.  
  1195.     EXTERN_API(void)
  1196.     InvokeFilePlayCompletionUPP       (SndChannelPtr            chan,
  1197.                                     FilePlayCompletionUPP    userUPP);
  1198.  
  1199. #else
  1200.     enum { uppFilePlayCompletionProcInfo = 0x000000C0 };             /* pascal no_return_value Func(4_bytes) */
  1201.     #define NewFilePlayCompletionUPP(userRoutine)                     (FilePlayCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  1202.     #define DisposeFilePlayCompletionUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  1203.     #define InvokeFilePlayCompletionUPP(chan, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppFilePlayCompletionProcInfo, (chan))
  1204. #endif
  1205. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1206. #define NewFilePlayCompletionProc(userRoutine)                     NewFilePlayCompletionUPP(userRoutine)
  1207. #define CallFilePlayCompletionProc(userRoutine, chan)            InvokeFilePlayCompletionUPP(chan, userRoutine)
  1208. /*
  1209.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1210.    prototypes
  1211.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1212. */
  1213.  
  1214.  
  1215. /* Sound Manager routines */
  1216. EXTERN_API( void )
  1217. SysBeep                            (short                     duration)                            ONEWORDINLINE(0xA9C8);
  1218.  
  1219. EXTERN_API( OSErr )
  1220. SndDoCommand                    (SndChannelPtr             chan,
  1221.                                  const SndCommand *        cmd,
  1222.                                  Boolean                 noWait)                                ONEWORDINLINE(0xA803);
  1223.  
  1224. EXTERN_API( OSErr )
  1225. SndDoImmediate                    (SndChannelPtr             chan,
  1226.                                  const SndCommand *        cmd)                                ONEWORDINLINE(0xA804);
  1227.  
  1228. EXTERN_API( OSErr )
  1229. SndNewChannel                    (SndChannelPtr *        chan,
  1230.                                  short                     synth,
  1231.                                  long                     init,
  1232.                                  SndCallBackUPP         userRoutine)                        ONEWORDINLINE(0xA807);
  1233.  
  1234. EXTERN_API( OSErr )
  1235. SndDisposeChannel                (SndChannelPtr             chan,
  1236.                                  Boolean                 quietNow)                            ONEWORDINLINE(0xA801);
  1237.  
  1238. EXTERN_API( OSErr )
  1239. SndPlay                            (SndChannelPtr             chan,
  1240.                                  SndListHandle             sndHandle,
  1241.                                  Boolean                 async)                                ONEWORDINLINE(0xA805);
  1242.  
  1243. #if OLDROUTINENAMES
  1244. EXTERN_API( OSErr )
  1245. SndAddModifier                    (SndChannelPtr             chan,
  1246.                                  Ptr                     modifier,
  1247.                                  short                     id,
  1248.                                  long                     init)                                ONEWORDINLINE(0xA802);
  1249.  
  1250. #endif  /* OLDROUTINENAMES */
  1251.  
  1252. EXTERN_API( OSErr )
  1253. SndControl                        (short                     id,
  1254.                                  SndCommand *            cmd)                                ONEWORDINLINE(0xA806);
  1255.  
  1256. /* Sound Manager 2.0 and later, uses _SoundDispatch */
  1257. EXTERN_API( NumVersion )
  1258. SndSoundManagerVersion            (void)                                                        FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  1259.  
  1260. EXTERN_API( OSErr )
  1261. SndStartFilePlay                (SndChannelPtr             chan,
  1262.                                  short                     fRefNum,
  1263.                                  short                     resNum,
  1264.                                  long                     bufferSize,
  1265.                                  void *                    theBuffer,
  1266.                                  AudioSelectionPtr         theSelection,
  1267.                                  FilePlayCompletionUPP     theCompletion,
  1268.                                  Boolean                 async)                                FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  1269.  
  1270. EXTERN_API( OSErr )
  1271. SndPauseFilePlay                (SndChannelPtr             chan)                                FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  1272.  
  1273. EXTERN_API( OSErr )
  1274. SndStopFilePlay                    (SndChannelPtr             chan,
  1275.                                  Boolean                 quietNow)                            FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  1276.  
  1277. EXTERN_API( OSErr )
  1278. SndChannelStatus                (SndChannelPtr             chan,
  1279.                                  short                     theLength,
  1280.                                  SCStatusPtr             theStatus)                            FOURWORDINLINE(0x203C, 0x0510, 0x0008, 0xA800);
  1281.  
  1282. EXTERN_API( OSErr )
  1283. SndManagerStatus                (short                     theLength,
  1284.                                  SMStatusPtr             theStatus)                            FOURWORDINLINE(0x203C, 0x0314, 0x0008, 0xA800);
  1285.  
  1286. EXTERN_API( void )
  1287. SndGetSysBeepState                (short *                sysBeepState)                        FOURWORDINLINE(0x203C, 0x0218, 0x0008, 0xA800);
  1288.  
  1289. EXTERN_API( OSErr )
  1290. SndSetSysBeepState                (short                     sysBeepState)                        FOURWORDINLINE(0x203C, 0x011C, 0x0008, 0xA800);
  1291.  
  1292. EXTERN_API( OSErr )
  1293. SndPlayDoubleBuffer                (SndChannelPtr             chan,
  1294.                                  SndDoubleBufferHeaderPtr  theParams)                        FOURWORDINLINE(0x203C, 0x0420, 0x0008, 0xA800);
  1295.  
  1296. /* MACE compression routines, uses _SoundDispatch */
  1297. EXTERN_API( NumVersion )
  1298. MACEVersion                        (void)                                                        FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  1299.  
  1300. EXTERN_API( void )
  1301. Comp3to1                        (const void *            inBuffer,
  1302.                                  void *                    outBuffer,
  1303.                                  unsigned long             cnt,
  1304.                                  StateBlockPtr             inState,
  1305.                                  StateBlockPtr             outState,
  1306.                                  unsigned long             numChannels,
  1307.                                  unsigned long             whichChannel)                        FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  1308.  
  1309. EXTERN_API( void )
  1310. Exp1to3                            (const void *            inBuffer,
  1311.                                  void *                    outBuffer,
  1312.                                  unsigned long             cnt,
  1313.                                  StateBlockPtr             inState,
  1314.                                  StateBlockPtr             outState,
  1315.                                  unsigned long             numChannels,
  1316.                                  unsigned long             whichChannel)                        FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  1317.  
  1318. EXTERN_API( void )
  1319. Comp6to1                        (const void *            inBuffer,
  1320.                                  void *                    outBuffer,
  1321.                                  unsigned long             cnt,
  1322.                                  StateBlockPtr             inState,
  1323.                                  StateBlockPtr             outState,
  1324.                                  unsigned long             numChannels,
  1325.                                  unsigned long             whichChannel)                        FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  1326.  
  1327. EXTERN_API( void )
  1328. Exp1to6                            (const void *            inBuffer,
  1329.                                  void *                    outBuffer,
  1330.                                  unsigned long             cnt,
  1331.                                  StateBlockPtr             inState,
  1332.                                  StateBlockPtr             outState,
  1333.                                  unsigned long             numChannels,
  1334.                                  unsigned long             whichChannel)                        FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  1335.  
  1336. /* Sound Manager 3.0 and later calls, uses _SoundDispatch */
  1337. EXTERN_API( OSErr )
  1338. GetSysBeepVolume                (long *                    level)                                FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  1339.  
  1340. EXTERN_API( OSErr )
  1341. SetSysBeepVolume                (long                     level)                                FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  1342.  
  1343. EXTERN_API( OSErr )
  1344. GetDefaultOutputVolume            (long *                    level)                                FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  1345.  
  1346. EXTERN_API( OSErr )
  1347. SetDefaultOutputVolume            (long                     level)                                FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  1348.  
  1349. EXTERN_API( OSErr )
  1350. GetSoundHeaderOffset            (SndListHandle             sndHandle,
  1351.                                  long *                    offset)                                FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  1352.  
  1353. EXTERN_API( UnsignedFixed )
  1354. UnsignedFixedMulDiv                (UnsignedFixed             value,
  1355.                                  UnsignedFixed             multiplier,
  1356.                                  UnsignedFixed             divisor)                            FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  1357.  
  1358. EXTERN_API( OSErr )
  1359. GetCompressionInfo                (short                     compressionID,
  1360.                                  OSType                 format,
  1361.                                  short                     numChannels,
  1362.                                  short                     sampleSize,
  1363.                                  CompressionInfoPtr     cp)                                    FOURWORDINLINE(0x203C, 0x0710, 0x0018, 0xA800);
  1364.  
  1365. EXTERN_API( OSErr )
  1366. SetSoundPreference                (OSType                 theType,
  1367.                                  Str255                 name,
  1368.                                  Handle                 settings)                            FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  1369.  
  1370. EXTERN_API( OSErr )
  1371. GetSoundPreference                (OSType                 theType,
  1372.                                  Str255                 name,
  1373.                                  Handle                 settings)                            FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  1374.  
  1375. EXTERN_API( OSErr )
  1376. OpenMixerSoundComponent            (SoundComponentDataPtr     outputDescription,
  1377.                                  long                     outputFlags,
  1378.                                  ComponentInstance *    mixerComponent)                        FOURWORDINLINE(0x203C, 0x0614, 0x0018, 0xA800);
  1379.  
  1380. EXTERN_API( OSErr )
  1381. CloseMixerSoundComponent        (ComponentInstance         ci)                                    FOURWORDINLINE(0x203C, 0x0218, 0x0018, 0xA800);
  1382.  
  1383. /* Sound Manager 3.1 and later calls, uses _SoundDispatch */
  1384. EXTERN_API( OSErr )
  1385. SndGetInfo                        (SndChannelPtr             chan,
  1386.                                  OSType                 selector,
  1387.                                  void *                    infoPtr)                            FOURWORDINLINE(0x203C, 0x063C, 0x0018, 0xA800);
  1388.  
  1389. EXTERN_API( OSErr )
  1390. SndSetInfo                        (SndChannelPtr             chan,
  1391.                                  OSType                 selector,
  1392.                                  const void *            infoPtr)                            FOURWORDINLINE(0x203C, 0x0640, 0x0018, 0xA800);
  1393.  
  1394. EXTERN_API( OSErr )
  1395. GetSoundOutputInfo                (Component                 outputDevice,
  1396.                                  OSType                 selector,
  1397.                                  void *                    infoPtr)                            FOURWORDINLINE(0x203C, 0x0644, 0x0018, 0xA800);
  1398.  
  1399. EXTERN_API( OSErr )
  1400. SetSoundOutputInfo                (Component                 outputDevice,
  1401.                                  OSType                 selector,
  1402.                                  const void *            infoPtr)                            FOURWORDINLINE(0x203C, 0x0648, 0x0018, 0xA800);
  1403.  
  1404. /* Sound Manager 3.2 and later calls, uses _SoundDispatch */
  1405. EXTERN_API( OSErr )
  1406. GetCompressionName                (OSType                 compressionType,
  1407.                                  Str255                 compressionName)                    FOURWORDINLINE(0x203C, 0x044C, 0x0018, 0xA800);
  1408.  
  1409. EXTERN_API( OSErr )
  1410. SoundConverterOpen                (const SoundComponentData * inputFormat,
  1411.                                  const SoundComponentData * outputFormat,
  1412.                                  SoundConverter *        sc)                                    FOURWORDINLINE(0x203C, 0x0650, 0x0018, 0xA800);
  1413.  
  1414. EXTERN_API( OSErr )
  1415. SoundConverterClose                (SoundConverter         sc)                                    FOURWORDINLINE(0x203C, 0x0254, 0x0018, 0xA800);
  1416.  
  1417. EXTERN_API( OSErr )
  1418. SoundConverterGetBufferSizes    (SoundConverter         sc,
  1419.                                  unsigned long             inputBytesTarget,
  1420.                                  unsigned long *        inputFrames,
  1421.                                  unsigned long *        inputBytes,
  1422.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0A58, 0x0018, 0xA800);
  1423.  
  1424. EXTERN_API( OSErr )
  1425. SoundConverterBeginConversion    (SoundConverter         sc)                                    FOURWORDINLINE(0x203C, 0x025C, 0x0018, 0xA800);
  1426.  
  1427. EXTERN_API( OSErr )
  1428. SoundConverterConvertBuffer        (SoundConverter         sc,
  1429.                                  const void *            inputPtr,
  1430.                                  unsigned long             inputFrames,
  1431.                                  void *                    outputPtr,
  1432.                                  unsigned long *        outputFrames,
  1433.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0C60, 0x0018, 0xA800);
  1434.  
  1435. EXTERN_API( OSErr )
  1436. SoundConverterEndConversion        (SoundConverter         sc,
  1437.                                  void *                    outputPtr,
  1438.                                  unsigned long *        outputFrames,
  1439.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0864, 0x0018, 0xA800);
  1440.  
  1441. /* Sound Manager 3.3 and later calls, uses _SoundDispatch */
  1442. EXTERN_API( OSErr )
  1443. SoundConverterGetInfo            (SoundConverter         sc,
  1444.                                  OSType                 selector,
  1445.                                  void *                    infoPtr)                            FOURWORDINLINE(0x203C, 0x0668, 0x0018, 0xA800);
  1446.  
  1447. EXTERN_API( OSErr )
  1448. SoundConverterSetInfo            (SoundConverter         sc,
  1449.                                  OSType                 selector,
  1450.                                  void *                    infoPtr)                            FOURWORDINLINE(0x203C, 0x066C, 0x0018, 0xA800);
  1451.  
  1452. /* Sound Manager 3.6 and later calls, uses _SoundDispatch */
  1453. EXTERN_API( OSErr )
  1454. SoundConverterFillBuffer        (SoundConverter         sc,
  1455.                                  SoundConverterFillBufferDataUPP  fillBufferDataUPP,
  1456.                                  void *                    fillBufferDataRefCon,
  1457.                                  void *                    outputBuffer,
  1458.                                  unsigned long             outputBufferByteSize,
  1459.                                  unsigned long *        bytesWritten,
  1460.                                  unsigned long *        framesWritten,
  1461.                                  unsigned long *        outputFlags)                        FOURWORDINLINE(0x203C, 0x1078, 0x0018, 0xA800);
  1462.  
  1463. EXTERN_API( OSErr )
  1464. SoundManagerGetInfo                (OSType                 selector,
  1465.                                  void *                    infoPtr)                            FOURWORDINLINE(0x203C, 0x047C, 0x0018, 0xA800);
  1466.  
  1467. EXTERN_API( OSErr )
  1468. SoundManagerSetInfo                (OSType                 selector,
  1469.                                  const void *            infoPtr)                            FOURWORDINLINE(0x203C, 0x0480, 0x0018, 0xA800);
  1470.  
  1471. /*
  1472.   Sound Component Functions
  1473.    basic sound component functions
  1474. */
  1475.  
  1476. EXTERN_API( ComponentResult )
  1477. SoundComponentInitOutputDevice    (ComponentInstance         ti,
  1478.                                  long                     actions)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1479.  
  1480. EXTERN_API( ComponentResult )
  1481. SoundComponentSetSource            (ComponentInstance         ti,
  1482.                                  SoundSource             sourceID,
  1483.                                  ComponentInstance         source)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0002, 0x7000, 0xA82A);
  1484.  
  1485. EXTERN_API( ComponentResult )
  1486. SoundComponentGetSource            (ComponentInstance         ti,
  1487.                                  SoundSource             sourceID,
  1488.                                  ComponentInstance *    source)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0003, 0x7000, 0xA82A);
  1489.  
  1490. EXTERN_API( ComponentResult )
  1491. SoundComponentGetSourceData        (ComponentInstance         ti,
  1492.                                  SoundComponentDataPtr * sourceData)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  1493.  
  1494. EXTERN_API( ComponentResult )
  1495. SoundComponentSetOutput            (ComponentInstance         ti,
  1496.                                  SoundComponentDataPtr     requested,
  1497.                                  SoundComponentDataPtr * actual)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0005, 0x7000, 0xA82A);
  1498.  
  1499. /* junction methods for the mixer, must be called at non-interrupt level*/
  1500. EXTERN_API( ComponentResult )
  1501. SoundComponentAddSource            (ComponentInstance         ti,
  1502.                                  SoundSource *            sourceID)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0101, 0x7000, 0xA82A);
  1503.  
  1504. EXTERN_API( ComponentResult )
  1505. SoundComponentRemoveSource        (ComponentInstance         ti,
  1506.                                  SoundSource             sourceID)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0102, 0x7000, 0xA82A);
  1507.  
  1508. /* info methods*/
  1509. EXTERN_API( ComponentResult )
  1510. SoundComponentGetInfo            (ComponentInstance         ti,
  1511.                                  SoundSource             sourceID,
  1512.                                  OSType                 selector,
  1513.                                  void *                    infoPtr)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0103, 0x7000, 0xA82A);
  1514.  
  1515. EXTERN_API( ComponentResult )
  1516. SoundComponentSetInfo            (ComponentInstance         ti,
  1517.                                  SoundSource             sourceID,
  1518.                                  OSType                 selector,
  1519.                                  void *                    infoPtr)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0104, 0x7000, 0xA82A);
  1520.  
  1521. /* control methods*/
  1522. EXTERN_API( ComponentResult )
  1523. SoundComponentStartSource        (ComponentInstance         ti,
  1524.                                  short                     count,
  1525.                                  SoundSource *            sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0105, 0x7000, 0xA82A);
  1526.  
  1527. EXTERN_API( ComponentResult )
  1528. SoundComponentStopSource        (ComponentInstance         ti,
  1529.                                  short                     count,
  1530.                                  SoundSource *            sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0106, 0x7000, 0xA82A);
  1531.  
  1532. EXTERN_API( ComponentResult )
  1533. SoundComponentPauseSource        (ComponentInstance         ti,
  1534.                                  short                     count,
  1535.                                  SoundSource *            sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0107, 0x7000, 0xA82A);
  1536.  
  1537. EXTERN_API( ComponentResult )
  1538. SoundComponentPlaySourceBuffer    (ComponentInstance         ti,
  1539.                                  SoundSource             sourceID,
  1540.                                  SoundParamBlockPtr     pb,
  1541.                                  long                     actions)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0108, 0x7000, 0xA82A);
  1542.  
  1543.  
  1544. /* selectors for component calls */
  1545. enum {
  1546.     kSoundComponentInitOutputDeviceSelect            = 0x0001,
  1547.     kSoundComponentSetSourceSelect                    = 0x0002,
  1548.     kSoundComponentGetSourceSelect                    = 0x0003,
  1549.     kSoundComponentGetSourceDataSelect                = 0x0004,
  1550.     kSoundComponentSetOutputSelect                    = 0x0005,
  1551.     kSoundComponentAddSourceSelect                    = 0x0101,
  1552.     kSoundComponentRemoveSourceSelect                = 0x0102,
  1553.     kSoundComponentGetInfoSelect                    = 0x0103,
  1554.     kSoundComponentSetInfoSelect                    = 0x0104,
  1555.     kSoundComponentStartSourceSelect                = 0x0105,
  1556.     kSoundComponentStopSourceSelect                    = 0x0106,
  1557.     kSoundComponentPauseSourceSelect                = 0x0107,
  1558.     kSoundComponentPlaySourceBufferSelect            = 0x0108
  1559. };
  1560. /*Audio Components*/
  1561. /*Volume is described as a value between 0 and 1, with 0 indicating minimum
  1562.   volume and 1 indicating maximum volume; if the device doesn't support
  1563.   software control of volume, then a value of unimpErr is returned, indicating
  1564.   that these functions are not supported by the device
  1565. */
  1566. EXTERN_API( ComponentResult )
  1567. AudioGetVolume                    (ComponentInstance         ac,
  1568.                                  short                     whichChannel,
  1569.                                  ShortFixed *            volume)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0000, 0x7000, 0xA82A);
  1570.  
  1571. EXTERN_API( ComponentResult )
  1572. AudioSetVolume                    (ComponentInstance         ac,
  1573.                                  short                     whichChannel,
  1574.                                  ShortFixed             volume)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1575.  
  1576. /*If the device doesn't support software control of mute, then a value of unimpErr is
  1577. returned, indicating that these functions are not supported by the device.*/
  1578. EXTERN_API( ComponentResult )
  1579. AudioGetMute                    (ComponentInstance         ac,
  1580.                                  short                     whichChannel,
  1581.                                  short *                mute)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0002, 0x7000, 0xA82A);
  1582.  
  1583. EXTERN_API( ComponentResult )
  1584. AudioSetMute                    (ComponentInstance         ac,
  1585.                                  short                     whichChannel,
  1586.                                  short                     mute)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0003, 0x7000, 0xA82A);
  1587.  
  1588. /*AudioSetToDefaults causes the associated device to reset its volume and mute values
  1589. (and perhaps other characteristics, e.g. attenuation) to "factory default" settings*/
  1590. EXTERN_API( ComponentResult )
  1591. AudioSetToDefaults                (ComponentInstance         ac)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  1592.  
  1593. /*This routine is required; it must be implemented by all audio components*/
  1594.  
  1595. EXTERN_API( ComponentResult )
  1596. AudioGetInfo                    (ComponentInstance         ac,
  1597.                                  AudioInfoPtr             info)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1598.  
  1599. EXTERN_API( ComponentResult )
  1600. AudioGetBass                    (ComponentInstance         ac,
  1601.                                  short                     whichChannel,
  1602.                                  short *                bass)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
  1603.  
  1604. EXTERN_API( ComponentResult )
  1605. AudioSetBass                    (ComponentInstance         ac,
  1606.                                  short                     whichChannel,
  1607.                                  short                     bass)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1608.  
  1609. EXTERN_API( ComponentResult )
  1610. AudioGetTreble                    (ComponentInstance         ac,
  1611.                                  short                     whichChannel,
  1612.                                  short *                Treble)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
  1613.  
  1614. EXTERN_API( ComponentResult )
  1615. AudioSetTreble                    (ComponentInstance         ac,
  1616.                                  short                     whichChannel,
  1617.                                  short                     Treble)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0009, 0x7000, 0xA82A);
  1618.  
  1619. EXTERN_API( ComponentResult )
  1620. AudioGetOutputDevice            (ComponentInstance         ac,
  1621.                                  Component *            outputDevice)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
  1622.  
  1623. /*This is routine is private to the AudioVision component.  It enables the watching of the mute key.*/
  1624. EXTERN_API( ComponentResult )
  1625. AudioMuteOnEvent                (ComponentInstance         ac,
  1626.                                  short                     muteOnEvent)                        FIVEWORDINLINE(0x2F3C, 0x0002, 0x0081, 0x7000, 0xA82A);
  1627.  
  1628.  
  1629. /* selectors for component calls */
  1630. enum {
  1631.     kAudioGetVolumeSelect                            = 0x0000,
  1632.     kAudioSetVolumeSelect                            = 0x0001,
  1633.     kAudioGetMuteSelect                                = 0x0002,
  1634.     kAudioSetMuteSelect                                = 0x0003,
  1635.     kAudioSetToDefaultsSelect                        = 0x0004,
  1636.     kAudioGetInfoSelect                                = 0x0005,
  1637.     kAudioGetBassSelect                                = 0x0006,
  1638.     kAudioSetBassSelect                                = 0x0007,
  1639.     kAudioGetTrebleSelect                            = 0x0008,
  1640.     kAudioSetTrebleSelect                            = 0x0009,
  1641.     kAudioGetOutputDeviceSelect                        = 0x000A,
  1642.     kAudioMuteOnEventSelect                            = 0x0081
  1643. };
  1644.  
  1645. enum {
  1646.     kDelegatedSoundComponentSelectors = 0x0100
  1647. };
  1648.  
  1649.  
  1650.  
  1651. /* Sound Input Manager routines, uses _SoundDispatch */
  1652. EXTERN_API( NumVersion )
  1653. SPBVersion                        (void)                                                        FOURWORDINLINE(0x203C, 0x0000, 0x0014, 0xA800);
  1654.  
  1655. EXTERN_API( OSErr )
  1656. SndRecord                        (ModalFilterUPP         filterProc,
  1657.                                  Point                     corner,
  1658.                                  OSType                 quality,
  1659.                                  SndListHandle *        sndHandle)                            FOURWORDINLINE(0x203C, 0x0804, 0x0014, 0xA800);
  1660.  
  1661. EXTERN_API( OSErr )
  1662. SndRecordToFile                    (ModalFilterUPP         filterProc,
  1663.                                  Point                     corner,
  1664.                                  OSType                 quality,
  1665.                                  short                     fRefNum)                            FOURWORDINLINE(0x203C, 0x0708, 0x0014, 0xA800);
  1666.  
  1667. EXTERN_API( OSErr )
  1668. SPBSignInDevice                    (short                     deviceRefNum,
  1669.                                  ConstStr255Param         deviceName)                            FOURWORDINLINE(0x203C, 0x030C, 0x0014, 0xA800);
  1670.  
  1671. EXTERN_API( OSErr )
  1672. SPBSignOutDevice                (short                     deviceRefNum)                        FOURWORDINLINE(0x203C, 0x0110, 0x0014, 0xA800);
  1673.  
  1674. EXTERN_API( OSErr )
  1675. SPBGetIndexedDevice                (short                     count,
  1676.                                  Str255                 deviceName,
  1677.                                  Handle *                deviceIconHandle)                    FOURWORDINLINE(0x203C, 0x0514, 0x0014, 0xA800);
  1678.  
  1679. EXTERN_API( OSErr )
  1680. SPBOpenDevice                    (ConstStr255Param         deviceName,
  1681.                                  short                     permission,
  1682.                                  long *                    inRefNum)                            FOURWORDINLINE(0x203C, 0x0518, 0x0014, 0xA800);
  1683.  
  1684. EXTERN_API( OSErr )
  1685. SPBCloseDevice                    (long                     inRefNum)                            FOURWORDINLINE(0x203C, 0x021C, 0x0014, 0xA800);
  1686.  
  1687. EXTERN_API( OSErr )
  1688. SPBRecord                        (SPBPtr                 inParamPtr,
  1689.                                  Boolean                 asynchFlag)                            FOURWORDINLINE(0x203C, 0x0320, 0x0014, 0xA800);
  1690.  
  1691. EXTERN_API( OSErr )
  1692. SPBRecordToFile                    (short                     fRefNum,
  1693.                                  SPBPtr                 inParamPtr,
  1694.                                  Boolean                 asynchFlag)                            FOURWORDINLINE(0x203C, 0x0424, 0x0014, 0xA800);
  1695.  
  1696. EXTERN_API( OSErr )
  1697. SPBPauseRecording                (long                     inRefNum)                            FOURWORDINLINE(0x203C, 0x0228, 0x0014, 0xA800);
  1698.  
  1699. EXTERN_API( OSErr )
  1700. SPBResumeRecording                (long                     inRefNum)                            FOURWORDINLINE(0x203C, 0x022C, 0x0014, 0xA800);
  1701.  
  1702. EXTERN_API( OSErr )
  1703. SPBStopRecording                (long                     inRefNum)                            FOURWORDINLINE(0x203C, 0x0230, 0x0014, 0xA800);
  1704.  
  1705. EXTERN_API( OSErr )
  1706. SPBGetRecordingStatus            (long                     inRefNum,
  1707.                                  short *                recordingStatus,
  1708.                                  short *                meterLevel,
  1709.                                  unsigned long *        totalSamplesToRecord,
  1710.                                  unsigned long *        numberOfSamplesRecorded,
  1711.                                  unsigned long *        totalMsecsToRecord,
  1712.                                  unsigned long *        numberOfMsecsRecorded)                FOURWORDINLINE(0x203C, 0x0E34, 0x0014, 0xA800);
  1713.  
  1714. EXTERN_API( OSErr )
  1715. SPBGetDeviceInfo                (long                     inRefNum,
  1716.                                  OSType                 infoType,
  1717.                                  void *                    infoData)                            FOURWORDINLINE(0x203C, 0x0638, 0x0014, 0xA800);
  1718.  
  1719. EXTERN_API( OSErr )
  1720. SPBSetDeviceInfo                (long                     inRefNum,
  1721.                                  OSType                 infoType,
  1722.                                  void *                    infoData)                            FOURWORDINLINE(0x203C, 0x063C, 0x0014, 0xA800);
  1723.  
  1724. EXTERN_API( OSErr )
  1725. SPBMillisecondsToBytes            (long                     inRefNum,
  1726.                                  long *                    milliseconds)                        FOURWORDINLINE(0x203C, 0x0440, 0x0014, 0xA800);
  1727.  
  1728. EXTERN_API( OSErr )
  1729. SPBBytesToMilliseconds            (long                     inRefNum,
  1730.                                  long *                    byteCount)                            FOURWORDINLINE(0x203C, 0x0444, 0x0014, 0xA800);
  1731.  
  1732. EXTERN_API( OSErr )
  1733. SetupSndHeader                    (SndListHandle             sndHandle,
  1734.                                  short                     numChannels,
  1735.                                  UnsignedFixed             sampleRate,
  1736.                                  short                     sampleSize,
  1737.                                  OSType                 compressionType,
  1738.                                  short                     baseNote,
  1739.                                  unsigned long             numBytes,
  1740.                                  short *                headerLen)                            FOURWORDINLINE(0x203C, 0x0D48, 0x0014, 0xA800);
  1741.  
  1742. EXTERN_API( OSErr )
  1743. SetupAIFFHeader                    (short                     fRefNum,
  1744.                                  short                     numChannels,
  1745.                                  UnsignedFixed             sampleRate,
  1746.                                  short                     sampleSize,
  1747.                                  OSType                 compressionType,
  1748.                                  unsigned long             numBytes,
  1749.                                  unsigned long             numFrames)                            FOURWORDINLINE(0x203C, 0x0B4C, 0x0014, 0xA800);
  1750.  
  1751. /* Sound Input Manager 1.1 and later calls, uses _SoundDispatch */
  1752. EXTERN_API( OSErr )
  1753. ParseAIFFHeader                    (short                     fRefNum,
  1754.                                  SoundComponentData *    sndInfo,
  1755.                                  unsigned long *        numFrames,
  1756.                                  unsigned long *        dataOffset)                            FOURWORDINLINE(0x203C, 0x0758, 0x0014, 0xA800);
  1757.  
  1758. EXTERN_API( OSErr )
  1759. ParseSndHeader                    (SndListHandle             sndHandle,
  1760.                                  SoundComponentData *    sndInfo,
  1761.                                  unsigned long *        numFrames,
  1762.                                  unsigned long *        dataOffset)                            FOURWORDINLINE(0x203C, 0x085C, 0x0014, 0xA800);
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768. #if !TARGET_OS_MAC
  1769. /*  Only to be used if you are writing a sound input component; this */
  1770. /*  is the param block for a read request from the SoundMgr to the   */
  1771. /*  sound input component.  Not to be confused with the SPB struct   */
  1772. /*  above, which is the param block for a read request from an app   */
  1773. /*  to the SoundMgr.                                                 */
  1774. typedef struct SndInputCmpParam         SndInputCmpParam;
  1775. typedef SndInputCmpParam *                SndInputCmpParamPtr;
  1776. typedef CALLBACK_API( void , SICCompletionProcPtr )(SndInputCmpParamPtr SICParmPtr);
  1777.  
  1778. struct SndInputCmpParam {
  1779.     SICCompletionProcPtr             ioCompletion;                /* completion routine [pointer]*/
  1780.     SIInterruptProcPtr                 ioInterrupt;                /* interrupt routine [pointer]*/
  1781.     OSErr                             ioResult;                    /* I/O result code [word]*/
  1782.     short                             pad;
  1783.     unsigned long                     ioReqCount;
  1784.     unsigned long                     ioActCount;
  1785.     Ptr                             ioBuffer;
  1786.     Ptr                             ioMisc;
  1787. };
  1788.  
  1789. EXTERN_API( ComponentResult )
  1790. SndInputReadAsync                (ComponentInstance         self,
  1791.                                  SndInputCmpParamPtr     SICParmPtr)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1792.  
  1793. EXTERN_API( ComponentResult )
  1794. SndInputReadSync                (ComponentInstance         self,
  1795.                                  SndInputCmpParamPtr     SICParmPtr)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0002, 0x7000, 0xA82A);
  1796.  
  1797. EXTERN_API( ComponentResult )
  1798. SndInputPauseRecording            (ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  1799.  
  1800. EXTERN_API( ComponentResult )
  1801. SndInputResumeRecording            (ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  1802.  
  1803. EXTERN_API( ComponentResult )
  1804. SndInputStopRecording            (ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
  1805.  
  1806. EXTERN_API( ComponentResult )
  1807. SndInputGetStatus                (ComponentInstance         self,
  1808.                                  short *                recordingStatus,
  1809.                                  unsigned long *        totalSamplesToRecord,
  1810.                                  unsigned long *        numberOfSamplesRecorded)            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0006, 0x7000, 0xA82A);
  1811.  
  1812. EXTERN_API( ComponentResult )
  1813. SndInputGetDeviceInfo            (ComponentInstance         self,
  1814.                                  OSType                 infoType,
  1815.                                  void *                    infoData)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0007, 0x7000, 0xA82A);
  1816.  
  1817. EXTERN_API( ComponentResult )
  1818. SndInputSetDeviceInfo            (ComponentInstance         self,
  1819.                                  OSType                 infoType,
  1820.                                  void *                    infoData)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0008, 0x7000, 0xA82A);
  1821.  
  1822. EXTERN_API( ComponentResult )
  1823. SndInputInitHardware            (ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
  1824.  
  1825.  
  1826. /* selectors for component calls */
  1827. enum {
  1828.     kSndInputReadAsyncSelect                        = 0x0001,
  1829.     kSndInputReadSyncSelect                            = 0x0002,
  1830.     kSndInputPauseRecordingSelect                    = 0x0003,
  1831.     kSndInputResumeRecordingSelect                    = 0x0004,
  1832.     kSndInputStopRecordingSelect                    = 0x0005,
  1833.     kSndInputGetStatusSelect                        = 0x0006,
  1834.     kSndInputGetDeviceInfoSelect                    = 0x0007,
  1835.     kSndInputSetDeviceInfoSelect                    = 0x0008,
  1836.     kSndInputInitHardwareSelect                        = 0x0009
  1837. };
  1838. #endif  /* !TARGET_OS_MAC */
  1839.  
  1840.  
  1841.  
  1842. #if PRAGMA_STRUCT_ALIGN
  1843.     #pragma options align=reset
  1844. #elif PRAGMA_STRUCT_PACKPUSH
  1845.     #pragma pack(pop)
  1846. #elif PRAGMA_STRUCT_PACK
  1847.     #pragma pack()
  1848. #endif
  1849.  
  1850. #ifdef PRAGMA_IMPORT_OFF
  1851. #pragma import off
  1852. #elif PRAGMA_IMPORT
  1853. #pragma import reset
  1854. #endif
  1855.  
  1856. #ifdef __cplusplus
  1857. }
  1858. #endif
  1859.  
  1860. #endif /* __SOUND__ */
  1861.  
  1862.